Node will not connect unless #define MY_PARENT_NODE_ID



  • Hi Guys,

    Using the latest 2.0.0 dev branch I'm having the issue where nodes will not connect unless I #define MY_PARENT_NODE_ID X. If I don't it just repeats:

    find parent
    send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    Init complete, id=1, parent=255, distance=255

    If I define the parent node, it connects, I can then write the sketch with it commented out?

    Sketch is simple (I'm using the default sketch for the ESP8266 gateway)

    // Enable debug prints
    #define MY_DEBUG
    
    #define MY_NODE_ID 1
    // #define MY_PARENT_NODE_ID 0
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    // #define MY_RADIO_RFM69
    
    // Enabled repeater feature for this node
    #define MY_REPEATER_FEATURE
    
    #include <SPI.h>
    #include <MySensor.h>
    #include <DHT.h>
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    DHT dht;
    float lastTemp;
    float lastHum;
    boolean metric = true;
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    
    void setup()
    {
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
      metric = getConfig().isMetric;
    }
    
    void presentation()
    {
      // Send the Sketch Version Information to the Gateway
      sendSketchInfo("T+H+R", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
    }
    
    void loop()
    {
      wait(dht.getMinimumSamplingPeriod()); // Delay or wait (repeater)
    
      // Fetch temperatures from DHT sensor
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
        Serial.println("Failed reading temperature from DHT");
      } else if (temperature != lastTemp) {
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        send(msgTemp.set(temperature, 1));
    #ifdef MY_DEBUG
        Serial.print("T: ");
        Serial.println(temperature);
    #endif
      }
    
      // Fetch humidity from DHT sensor
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
        Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum) {
        lastHum = humidity;
        send(msgHum.set(humidity, 1));
    #ifdef MY_DEBUG
        Serial.print("H: ");
        Serial.println(humidity);
    #endif
      }
      wait(SLEEP_TIME); // Sleep or wait (repeater)
    }
    


  • Morning guys,

    Does anyone have any ideas? As soon as I define a parent, all is well... Noob mistake I'm not seeing?

    EDIT: Okay, it seems the issue is simpler, if I take out the node ID it sits at req id, so I presume the gateway is not responding?

    Debug from sensor (I can see the other 2 that are deployed seem to communicate with it no problem?)

    Starting repeater (RNNRA-, 2.0.0-beta)
    Radio init successful.
    send: 1-1-2-0 s=255,c=3,t=15,pt=0,l=2,sg=0,st=fail:
    send: 1-1-2-0 s=255,c=0,t=18,pt=0,l=10,sg=0,st=fail:2.0.0-beta
    send: 1-1-2-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:2
    send: 1-1-2-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=fail:T+H+R
    send: 1-1-2-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:1.0
    send: 1-1-2-0 s=0,c=0,t=7,pt=0,l=0,sg=0,st=fail:
    find parent
    send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    send: 1-1-2-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    Init complete, id=1, parent=2, distance=255
    read and forward: 1-4-0 s=1,c=0,t=6,pt=0,l=0,sg=0
    send: 1-1-2-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
    read and forward: 1-4-0 s=1,c=0,t=6,pt=0,l=0,sg=0
    send: 1-1-2-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
    read and forward: 1-4-0 s=1,c=0,t=6,pt=0,l=0,sg=0
    send: 1-1-2-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    read and forward: 1-4-0 s=1,c=0,t=6,pt=0,l=0,sg=0
    send: 1-1-2-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
    send: 1-1-2-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:26.3
    T: 26.30
    send: 1-1-2-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=fail:38.6
    H: 38.60
    read and forward: 2-4-0 s=0,c=1,t=0,pt=7,l=5,sg=0
    send: 2-1-2-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:-24.1
    send: 1-1-2-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=fail:37.9
    H: 37.90
    read and forward: 2-4-0 s=0,c=1,t=0,pt=7,l=5,sg=0
    send: 2-1-2-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:-24.0
    find parent
    send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
    send: 1-1-2-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:25.8
    T: 25.80
    send: 1-1-2-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=fail:39.1
    H: 39.10
    read and forward: 2-4-0 s=0,c=1,t=0,pt=7,l=5,sg=0
    send: 2-1-2-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:-24.0
    

  • Mod

    st=fails means that the message didn't reach the next node, so the problem is a radio communication issue which is often caused by power problems.
    If you haven't looked at http://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help already you might get some help from the troubleshooting flowchart there.



  • @mfalkvidd

    My gateway is an NodeMCU with a NRF PA + LNA, it seems to be resolved if I use #define MY_RF24_PA_LEVEL RF24_PA_MIN on the gateway.

    Strange, as the NodeMCU has a AMS1117 which I believe can handle 800ma, presuming the ESP8266 uses 300ma max, that leaves 500ma, surely it should be enough?

    I've tried shielding the radio as suggested but it doesn't make a difference.


Log in to reply
 

Suggested Topics

  • 5
  • 3
  • 2
  • 3
  • 4
  • 4
  • 7
  • 3

107
Online

10.5k
Users

10.8k
Topics

110.6k
Posts