keep getting child_id 8 already exists in children of node



  • Hello all,
    I'm having a problem when I want to add a new sensor. Using mysensors 2.1.1. and try to register the 'PressureSensor' sketch from the MySensorsArduinoExamples git repository and have a bmp180 sensor connected.
    I know the MySensorsArduinoExamples repository is a 'use at own risk' area but I checked the sketch and it looks to be properly formed.

    What happens is that every time I try to add a sensor I get a message like this in the homeassistant logs :

    WARNING:mysensors:child_id 0 already exists in children of node 8, cannot add child

    The debug log on the arduino gives :

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    13 TSF:SID:OK,ID=8
    14 TSM:FPAR
    51 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    399 TSF:MSG:READ,0-0-8,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    403 TSF:MSG:FPAR OK,ID=0,D=1
    2058 TSM:FPAR:OK
    2059 TSM:ID
    2060 TSM:ID:OK
    2062 TSM:UPL
    2065 TSF:MSG:SEND,8-8-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2075 TSF:MSG:READ,0-0-8,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2079 TSF:MSG:PONG RECV,HP=1
    2082 TSM:UPL:OK
    2084 TSM:READY:ID=8,PAR=0,DIS=1
    2088 TSF:MSG:SEND,8-8-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2098 TSF:MSG:READ,0-0-8,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2105 TSF:MSG:SEND,8-8-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2113 TSF:MSG:SEND,8-8-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2392 TSF:MSG:READ,0-0-8,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2402 TSF:MSG:SEND,8-8-0-0,s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=OK:TemperatureAndPressure
    2412 TSF:MSG:SEND,8-8-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.2
    2420 TSF:MSG:SEND,8-8-0-0,s=0,c=0,t=8,pt=0,l=0,sg=0,ft=0,st=OK:
    2427 TSF:MSG:SEND,8-8-0-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
    2434 MCO:REG:REQ
    2439 TSF:MSG:SEND,8-8-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2446 TSF:MSG:READ,0-0-8,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2451 MCO:PIM:NODE REG=1
    2453 MCO:BGN:STP

    So the arduino tries to register but somehow it doesn't work. I ran the log parser and the last 2 lines of the output mean

    Registration response received, registration status 1
    Callback setup()

    Which I don't know what it means.
    In all of the homeassistant database and persistence file there is no record of a node 8 anywhere so it seems to come from mysensors...
    Anyone has an idea of what could be the reason failing registration ?
    Thanks in advance 🙂


  • Mod

    Pls post your code also.



  • #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <Wire.h>
    #include <Adafruit_BMP085.h>
    
    #define BARO_CHILD 0
    #define TEMP_CHILD 1
    
    const float ALTITUDE = 1; // <-- adapt this value to your own location's altitude.
    
    // Sleep time between reads (in seconds). Do not change this value as the forecast algorithm needs a sample every minute.
    const unsigned long SLEEP_TIME = 60000; 
    
    Adafruit_BMP085 bmp = Adafruit_BMP085();      // Digital Pressure Sensor 
    
    float lastPressure = -1;
    float lastTemp = -1;
    int lastForecast = -1;
    
    // this CONVERSION_FACTOR is used to convert from Pa to kPa in forecast algorithm
    // get kPa/h be dividing hPa by 10 
    #define CONVERSION_FACTOR (1.0/10.0)
    
    float dP_dt;
    bool metric;
    MyMessage tempMsg(TEMP_CHILD, V_TEMP);
    MyMessage pressureMsg(BARO_CHILD, V_PRESSURE);
    
    void setup() 
    {
    	if (!bmp.begin()) 
    	{
    		Serial.println('Could not find a valid BMP085 sensor, check wiring!');
    		while (1) {}
    	}
    	metric = getControllerConfig().isMetric;
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("TemperatureAndPressure", "1.4");
    
      // Register sensors to gw (they will be created as child devices)
      present(BARO_CHILD, S_BARO);
      present(TEMP_CHILD, S_TEMP);
    }
    
    void loop() 
    {
    	float pressure = bmp.readSealevelPressure(ALTITUDE) / 100.0;
    	float temperature = bmp.readTemperature();
    
    	if (!metric) 
    	{
    		// Convert to fahrenheit
    		temperature = temperature * 9.0 / 5.0 + 32.0;
    	}
    
    	Serial.print("Temperature = ");
    	Serial.print(temperature);
    	Serial.println(metric ? " *C" : " *F");
    	Serial.print("Pressure = ");
    	Serial.print(pressure);
    	Serial.println(" hPa");
    
    	if (temperature != lastTemp) 
    	{
    		send(tempMsg.set(temperature, 1));
    		lastTemp = temperature;
    	}
    	if (pressure != lastPressure) 
    	{
    		send(pressureMsg.set(pressure, 0));
    		lastPressure = pressure;
    	}
       	sleep(SLEEP_TIME);
    }
    

  • Mod

    Try changing the node ID to another number and then try different child ids for the sensors and see if you get any changes



  • @gohan I just tried that but still getting the same reply.
    I am wondering where this message points to.
    I.E. where the child_id is found. Is this a mysensors issue ? Or does this come from the controller ?



  • You may need to clear the EEPROM. Your Arduino may have child ID 8 stored to where it is recalling it every time from EEPROM. To clear it, you can't use any old clear EEPROM sketch. You need to use the MySensors one posted at this link: https://www.mysensors.org/build/debug#clearing-eeprom
    Try that and let us know. how it goes.



  • Thanks all for the advice. I cleared the eeprom and pushed the sketch again. The arduino does get a new device_id so that worked. After unplugging it from power and putting it back on I got the same message however and no readings.

    I found however that another sensor I have that is working and sending readings also gives a 'child_id already exists warning' when I powercycle it. So now I am thinking that the warning is normal behaviour when an already registered sensor comes back online.
    Than I compared the serial output in de log parser (amazing what a handy thing that is) with output from a working sensor.
    I noticed that everything looks the same upto the the line

    Callback setup()

    My not working sensor gave no more output after that but the working sensor continued by sending a reading and going to sleep.
    So I suspect there is something wrong with the sensor or sketch causing it to never correctly initialize.


Log in to reply
 

Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts