Cannot find parent, repeater nodes



  • Hello all,

    I've using MySensors successfully for a while now. I created a universal sketch for all of my sensor nodes, in which I can configure the different sensors connected. I have four sensor nodes running as of now, all on the ground floor (within range of the gateway). Now I'm trying to add more sensors on the first floor, just out of reach of my gateway (it seems).
    When I move the extra sensor closer to the gateway (say: room above the gateway), all works just fine
    However, when I move to another room (above three repeater nodes) I cannot get these extra sensors to work via the other nodes. It is stuck in the 'finding parent' state. I would expect that it would pick the lower-floor nodes to communicate to the gateway.

    Gateway hardware consist of an ESP8266 MQTT Gateway (with NRF24L01+ PA).
    Sensor nodes use an Arduino Pro Mini + NRF24L01+ sensors and are all powered via USB.

    Node code, I've deleted the sensor implementations (expect PIR) to make it a bit shorter.
    Implementation for the other sensors is equal to the one shown.
    It

    /*
       Sandolution (C) 2019 Sentire node
    
       The node is based on a Arduino Pro Mini with an NRF24L01 SMD connected to it.
       Additionally, multiple sensors can be connected to the board:
       -BME280 Temperature/Humidity/Barometric pressure
       -BH1750 Light intensity
       -DS18B20 Temperature (DI2)
       -MHZ19 CO2 Sensor (DI6/DI7)
       -DSM501A Dust Sensor (DI6/DI7)
       -Digital interrupt input (DI3)
       -Digital output (DI4)
    
       Software is written using MySensors library which handles all the wireless communications with the gateway.
    */
    
    
    //*******************************************************************************************************USER SETTINGS
    //Overall settings
    #define ReportingTime 600000                              //Sleep time between reports of a sensor (in milliseconds)  > 10 minutes
    #define UpdateDelay 500                                   //Sleep time between each send value (in milliseconds)
    #define MY_NODE_ID 60                                     //CHANGE THIS FOR EACH NODE
    #define DEBUG_PRINT                                       //Output data via serial port
    #define DEBUG_MYSENSORS                                   //Output MySensors data via serial port
    
    #define MY_ENCRYPTION_SIMPLE_PASSWD "P@ssWord"
    
    #define TimeMultiplier 12                                 //Multiplier to compensate for code execution
    
    //Define which sensors are present, comment to disable sensor
    //#define BME280                                            //TEMPERATURE + HUMIDITY + BAROMETRIC PRESSURE
    //#define BH1750                                            //LUX
    //#define DS18B20                                           //EXTERNAL TEMPERATURE
    //#define MH_Z19                                            //CO2 SENSOR
    //#define DSM501A                                           //DUST PARTICLE SENSOR
    #define IO_INPUT                                          //PIR
    //#define IO_OUTPUT                                         //RELAY
    
    //*******************************************************************************************************GENERAL SETTINGS
    #define SoftwareVersion "1.4.191230"
    
    //General I/O definitions
    #define DIGITAL_INPUT 3     //IO_INPUT
    #define DIGITAL_OUTPUT 4    //IO_OUTPUT
    #define ONEWIRE 2           //DS18B20
    #define SERIAL_RX 6         //MH_Z19
    #define SERIAL_TX 7         //MH_Z19
    #define PM25 6              //DSM501A
    #define PM10 7              //DSM501A
    
    //Create variables for reporting
    int InterruptCause; //Cause of interrupt
    long SleepTime; //Time remaining for sleeping
    
    //*******************************************************************************************************OBJECTS
    //Include proper libraries, create instances and mysensor objects
    
    
    //*******************************************************************************************************OBJECTS - MYSENSORS
    #if defined(DEBUG_MYSENSORS)
    //Settings
    #define MY_DEBUG              //Enable MySensors debug
    #endif
    
    #define MY_REPEATER_FEATURE     //Repeater active
    #define MY_RADIO_RF24           //Select proper radio type
    #define MY_RF24_ENABLE_ENCRYPTION //Enable encryption
    
    //Library
    #include <MySensors.h>
    
    
    //*******************************************************************************************************OBJECTS - IN/OUTPUTS
    #if defined(IO_INPUT)
    //MySensors
    MyMessage MSG_DigitalInput      (1, V_TRIPPED);
    
    //Variables
    bool DigitalInput_Old;
    #endif
    
    #if defined(IO_OUTPUT)
    //MySensors
    MyMessage MSG_DigitalOutput     (2, V_STATUS);
    #endif
    
    
    //********************************************************************************************************************************************SETUP
    void setup()
    {
    
    #if defined(DEBUG_PRINT)
      Serial.println("Connected to MySensors Network!");
    #endif
    
      //Reset time for sleeping
      InterruptCause = 255;
    #if defined(BATTERY_PWR)
      SleepTime = ReportingTime;
    #endif
    #if !defined(BATTERY_PWR)
      SleepTime = ReportingTime * TimeMultiplier;
    #endif
    
    
    
      //*******************************************************************************************************START SERIAL
    #if defined(DEBUG_PRINT)
      Serial.begin(115200);
    #endif
    
    
      //*******************************************************************************************************START I/O
      //INPUT
    #if defined(IO_INPUT)
      //Set mode
      pinMode(DIGITAL_INPUT, INPUT);
    #endif
    
      //OUTPUT
    #if defined(IO_OUTPUT)
      //Set mode
      pinMode(DIGITAL_OUTPUT, OUTPUT);
      //Write old state to output
      digitalWrite(DIGITAL_OUTPUT, loadState(DIGITAL_OUTPUT) ? 1 : 0);
    #endif
    
      //BATTERY SENSOR
    #if defined(BATTERY_PWR)
    #if defined(__AVR_ATmega2560__)
      analogReference(INTERNAL1V1);
    #else
      analogReference(INTERNAL);
    #endif
    #endif
    
    
    //********************************************************************************************************************************************PRESENTATION
    void presentation()
    {
      //Send relevant information to gateway
      sendSketchInfo("Sentire (USB)", SoftwareVersion);
    
      //Present all sensors to gateway
      //*******************************************************************************************************PRESENT IO
    #if defined(IO_INPUT)
      present(1, S_BINARY);  //Input
    #endif
    #if defined(IO_OUTPUT)
      present(2, S_BINARY);  //Output
    #endif
    
    }
    
    
    //********************************************************************************************************************************************LOOP
    void loop()
    {
    
    #if defined(IO_INPUT)
      if (DigitalInput_Old != digitalRead(DIGITAL_INPUT)) {
        InterruptCause = 1;   //Trigger action
    #if defined(DEBUG_PRINT)
        Serial.println("INTERRUPT: 1 (INPUT)");
    #endif
      }
    #endif
      if (SleepTime == 0) {
        InterruptCause = -1;  //Trigger action
    #if defined(DEBUG_PRINT)
        Serial.println("INTERRUPT: -1 (TIME)");
    #endif
      }
      else {
        SleepTime = SleepTime - 1;
      }
    
      //*******************************************************************************************************INTERRUPTED
      //IO interrupt wake up
      if (InterruptCause == 1 ) {
        //Reset cause
        InterruptCause = 255;
    
    #if defined(IO_INPUT)
        //Send update if chaged in between
        DigitalInput_Old = digitalRead(DIGITAL_INPUT);
        send(MSG_DigitalInput.set(DigitalInput_Old ? "1" : "0"));
    
        //Debug
    #if defined(DEBUG_PRINT)
        Serial.print("Interrupt: DI");
        Serial.print(DIGITAL_INPUT);
        Serial.print(" | ");
        Serial.println(DigitalInput_Old);
    #endif
    #endif
      }
    
      //Interrupt by time (-1) or no interrupt cause used (0)
      else if (InterruptCause == -1 ) {
    
        //Reset cause
        InterruptCause = 255;
    
        //Reset time for sleeping
        SleepTime = ReportingTime * TimeMultiplier;
    
      //ALL SENSOR CODE GOES HERE
    
        //*******************************************************************************************************MYSENSORS UPDATE - IO INPUT
    #if defined(IO_INPUT)
        //Send update if chaged in between
        DigitalInput_Old = digitalRead(DIGITAL_INPUT);
        send(MSG_DigitalInput.set(DigitalInput_Old ? "1" : "0"));
    #if defined(DEBUG_PRINT)
        Serial.print("DI");
        Serial.print(DIGITAL_INPUT);
        Serial.print(" | ");
        Serial.println(DigitalInput_Old);
    #endif
    #endif
    
    
      }//End IF-interrupt
    
    }//End loop
    
    

    To test if this was caused by my sketch, I added another node with the bare repeater sketch in it, located right above the gateway. Then I moved the sensor I'm trying to add 5 meters down the hallway, with a line of sight to the repeater node.

    This is the log output of the sensor node:
    LOG Link

    And of the repeater node:
    LOG Link

    Has someone an idea what could cause this?
    As far as I can tell, it's trying to connect directly to the gateway instead of using the repeater nodes.
    I'm not using sleep or similar functions in the sketch, so that couldn't be it.

    Thanks in advance!

    Regards,
    Sander



  • The same story at my end.
    When node is in repeater range only, it's not working. It works only when it has gateway in its range.
    So simply I don't know what for there is a repeater feature...
    The same radios on my side.



  • Has anybody tested the latest master release in combination with repeater nodes?
    I used version 2.3.2.
    Shall I test with a previous release of MySensors?
    As far as I can check, nothing changed regarding repeater nodes.

    I'll also check with an Arduino as gateway instead of an ESP8266.



  • I think, I started with version 2.1.1. and it works always the same. I'm on 2.3.2 currently and my GW is RPI3 with NRF24 radio attached (before it was NodeMCU v3).
    When there is no direct connection to the GW, then node is just inactive.



  • I have several repeaters, but the nodes also have (at least sometimes) connection to the gateway.
    In the repeater log, I don't see the node connecting to that repeater. I guess that is shown in the log at some point, right?
    Can you post logs where the node can see the gateway? What if it sees the gateway first, and then the gateway goes out of sight?
    Did you try to set a static parent id?



  • @Sandolution , @bwn , @electrik
    Did anyone of you find a solution for this problem?



Suggested Topics

11
Online

11.4k
Users

11.1k
Topics

112.7k
Posts