Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
M

maos

@maos
About
Posts
10
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • NRF24l01 Sensor_id aleatory
    M maos

    This??

    Basic gateway :

    // Enable debug prints to serial monitor
    #define MY_DEBUG

    // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
    #define MY_BAUD_RATE 115200

    // Enables and select radio type (if attached)
    #define MY_RADIO_RF24
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95

    #define MY_GATEWAY_MQTT_CLIENT
    #define MY_GATEWAY_ESP8266

    // Set this node's subscribe and publish topic prefix
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"

    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mysensors-1"

    // Enable these if your MQTT broker requires username/password
    //#define MY_MQTT_USER "username"
    //#define MY_MQTT_PASSWORD "password"

    // Set WIFI SSID and password
    #define MY_WIFI_SSID "xxx"
    #define MY_WIFI_PASSWORD "xxx"

    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    // #define MY_HOSTNAME "mqtt-sensor-gateway"

    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    //#define MY_IP_ADDRESS 192,168,178,87

    // If using static ip you can define Gateway and Subnet address as well
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0

    // MQTT broker ip address.
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 211

    //MQTT broker if using URL instead of ip address.
    //#define MY_CONTROLLER_URL_ADDRESS "192.168.1.211"

    // The MQTT broker port to to open
    #define MY_PORT 1883

    // Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN D1

    // Set blinking period
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300

    // Flash leds on rx/tx/err
    //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED

    #include <ESP8266WiFi.h>
    #include <MySensors.h>

    void setup()
    {
    // Setup locally attached sensors

    }

    void presentation()
    {
    // Present locally attached sensors here
    }

    void loop()
    {
    // Send locally attached sensors data here
    }

    Client, simple sketch to send only simple values like temperature a humidity :

    // Enable debug prints
    #define MY_DEBUG

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485

    #include <SPI.h>
    #include <MySensors.h>

    // Set this offset if the sensor has a permanent small offset to the real temperatures
    //#define SENSOR_TEMP_OFFSET 0

    // Sleep time between sensor updates (in milliseconds)
    // Must be >1000ms for DHT22 and >2000ms for DHT11
    static const uint64_t UPDATE_INTERVAL = 5000;

    // Force sending an update of the temperature after n sensor reads, so a controller showing the
    // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
    // the value didn't change since;
    // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
    //static const uint8_t FORCE_UPDATE_N_READS = 10;

    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1

    bool metric = true;

    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);

    void presentation()
    {
    // Send the sketch version information to the gateway
    sendSketchInfo("TemperatureAndHumidity", "1.1");

    // Register all sensors to gw (they will be created as child devices)
    present(CHILD_ID_HUM, S_HUM);
    present(CHILD_ID_TEMP, S_TEMP);

    metric = getControllerConfig().isMetric;
    }

    void setup()
    {

    }

    void loop()
    {

    send(msgTemp.set(12, 1));

    send(msgHum.set(66, 1));

    // Sleep for a while to save energy
    //sleep(UPDATE_INTERVAL);
    delay(UPDATE_INTERVAL);

    }

    0_1559485704664_ef06d18f-fdd9-489b-9358-cb7500661c70-image.png

    Development

  • NRF24l01 Sensor_id aleatory
    M maos

    I think that is a insufficient current. A mini is a 3.3v. Now a use a pro mini 5v, and work....

    Development

  • NRF24l01 Sensor_id aleatory
    M maos

    Stupid.....
    mygateway1-in / 3/0/1/0/1, to publish .....
    I'm going to study the library gradually, so far I think top

    Development
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular