MySensor auto node ID



  • I created MySensor ver.2.1.1 node without specifying explicit node ID (didn't define MY_NODE_ID macro).
    In this case node fails to connect to the controller with the following messages:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.0.1-beta
    10 TSM:INIT
    20 TSM:INIT:TSP OK
    24 !TSF:SID:FAIL,ID=0
    30 TSM:FAIL:CNT=1
    36 TSM:FAIL:PDT
    10041 TSM:FAIL:RE-INIT
    10047 TSM:INIT
    10057 TSM:INIT:TSP OK
    10063 !TSF:SID:FAIL,ID=0
    10070 TSM:FAIL:CNT=2

    If I define node ID (e.g. #define MY_NODE_ID 100) node succeeds to register.

    What I am missing?


  • ADMIN

    @benya Can you try with #define NODE_ID AUTO ?



  • Tried.
    Still cannot register with gateway and controller.


  • ADMIN

    @benya can you post your sketch?





  • @benya said:

    @jkandasa said:

    @benya can you post your sketch?

    See https://github.com/QnuVGXic3n9H/HomeAutomation/blob/master/Arduino/MotionSensor/MotionSensor.ino

    Did you find any issues in my code?


  • ADMIN

    @benya I do not see any fault on your code. Can you check does your sketch already holds some id? Try to erase EEPROM and try again.



  • @jkandasa said:

    @benya I do not see any fault on your code. Can you check does your sketch already holds some id? Try to erase EEPROM and try again.

    I cleared EEPROM and used bare minimum sketch:

    #define MY_RADIO_NRF24
    #define MY_BAUD_RATE 38400
    #define MY_DEBUG
    
    #include <MySensors.h>
    #include <SPI.h>
    
    #define SENSOR_ID 1
    
    #define OPEN 1
    #define CLOSE 0
    
    MyMessage msg(SENSOR_ID, V_TRIPPED);
    
    uint8_t value = OPEN;
    
    void presentation()
    {
        present(SENSOR_ID, S_DOOR);
    }
    
    void loop()
    {
        value = value == OPEN ? CLOSE : OPEN;
        send(msg.set(value));
        sleep(10000);
    }
    

    and node still fails to register:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    10 TSM:INIT
    12 TSF:WUR:MS=0
    22 TSM:INIT:TSP OK
    28 !TSF:SID:FAIL,ID=0
    34 TSM:FAIL:CNT=1
    38 TSM:FAIL:PDT
    10045 TSM:FAIL:RE-INIT
    10051 TSM:INIT
    10061 TSM:INIT:TSP OK
    10067 !TSF:SID:FAIL,ID=0
    10074 TSM:FAIL:CNT=2
    10080 TSM:FAIL:PDT
    20086 TSM:FAIL:RE-INIT


  • As soon as I set specific NODE_ID:

    #define MY_NODE_ID 1
    

    node is able to connect:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    10 TSM:INIT
    12 TSF:WUR:MS=0
    22 TSM:INIT:TSP OK
    28 TSM:INIT:STATID=1
    36 TSF:SID:OK,ID=1
    43 TSM:FPAR
    79 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    292 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    307 TSF:MSG:FPAR OK,ID=0,D=1
    2101 TSM:FPAR:OK
    2105 TSM:ID
    2109 TSM:ID:OK
    2113 TSM:UPL
    2117 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2136 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2150 TSF:MSG:PONG RECV,HP=1
    2158 TSM:UPL:OK
    2162 TSM:READY:ID=1,PAR=0,DIS=1
    2207 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
    4229 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=1,st=OK:2.1.1
    4251 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    6268 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    6287 MCO:REG:REQ
    6326 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=NACK:2
    7239 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=6,sg=0:Metric
    8382 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=NACK:2
    10401 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=2,st=OK:2
    10420 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    10436 MCO:PIM:NODE REG=1
    10442 MCO:BGN:INIT OK,TSP=1
    10452 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=OK:0
    10471 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
    10485 MCO:SLP:TPD
    10491 MCO:SLP:WUP=-1

  • ADMIN

    @benya Does your radio receives Rx pocket from gateway? Can you check gateway debug log?



  • @jkandasa
    How could I check?
    I posted logs already.


  • ADMIN

    @benya Enable debug message on gateway node, and capture log message



  • @jkandasa
    Gateway log when node uses MY_NODE_ID=AUTO:

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    

    Node's log:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    10 TSM:INIT
    12 TSF:WUR:MS=0
    22 TSM:INIT:TSP OK
    28 !TSF:SID:FAIL,ID=0
    34 TSM:FAIL:CNT=1
    38 TSM:FAIL:PDT
    10045 TSM:FAIL:RE-INIT
    10051 TSM:INIT
    10061 TSM:INIT:TSP OK
    10067 !TSF:SID:FAIL,ID=0
    10074 TSM:FAIL:CNT=2
    10080 TSM:FAIL:PDT
    20086 TSM:FAIL:RE-INIT
    20092 TSM:INIT
    20103 TSM:INIT:TSP OK
    20109 !TSF:SID:FAIL,ID=0
    20115 TSM:FAIL:CNT=3
    20121 TSM:FAIL:PDT
    

    Gateway log when node uses MY_NODE_ID=1:

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    mysgw: TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=1
    mysgw: TSF:PNG:SEND,TO=0
    mysgw: TSF:CKU:OK
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    mysgw: TSF:MSG:PINGED,ID=1,HP=1
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.1.1
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    mysgw: TSF:MSG:READ,1-1-0,s=1,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=NACK:1
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
    mysgw: TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=1,l=1,sg=0:0
    mysgw: TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=1,l=1,sg=0:1
    

    Node log:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    10 TSM:INIT
    12 TSF:WUR:MS=0
    22 TSM:INIT:TSP OK
    28 TSM:INIT:STATID=1
    36 TSF:SID:OK,ID=1
    43 TSM:FPAR
    79 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    354 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    368 TSF:MSG:FPAR OK,ID=0,D=1
    2101 TSM:FPAR:OK
    2105 TSM:ID
    2109 TSM:ID:OK
    2113 TSM:UPL
    2117 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2136 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2150 TSF:MSG:PONG RECV,HP=1
    2158 TSM:UPL:OK
    2162 TSM:READY:ID=1,PAR=0,DIS=1
    2207 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
    2228 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2256 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=1,st=OK:2.1.1
    2293 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4313 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4331 MCO:REG:REQ
    4370 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=NACK:2
    6397 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
    6416 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    6430 MCO:PIM:NODE REG=1
    6436 MCO:BGN:INIT OK,TSP=1
    6453 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=OK:0
    6469 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
    6483 MCO:SLP:TPD
    6490 MCO:SLP:WUP=-1

  • ADMIN

    @benya Thank you for the log and your patience. You can see from the gateway log, when you have enabled NODE_ID=AUTO, the gateway does not receive any request from the node. So it is problem between node and gateway. As gateway didn't receive and node id request MyController also do not know about it.

    You have to check with MySensors guys. I request to go to the previous version of MySensors as well as the current version of the MySensors library. This issue might be with specific version too.



  • @jkandasa Turned out that EEPROM was not cleared properly with 0xFF



  • @benya how did you see that it wasn't fully cleared, what script did you use to clear the EEPROM, are you using AUTO node id?



  • @mpp Guys in MySensors forum noticed I cleared EEPROM with zeros instead of 0xFF.


Log in to reply