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
  1. Home
  2. Troubleshooting
  3. MySensor auto node ID

MySensor auto node ID

Scheduled Pinned Locked Moved Troubleshooting
7 Posts 4 Posters 5.2k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • benyaB Offline
    benyaB Offline
    benya
    wrote on last edited by
    #1

    Setup:

    • Raspberry Pi serial gateway.
    • Node on Arduino Nano. Bare minimum code.

    Problem:
    Node fails to register when neither NODE_ID or MY_NODE_ID defined. It registers fine when MY_NODE_ID defined explicitly.

    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);
    }
    

    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 with MY_NODE_ID=AUTO:

    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 with MY_NODE_ID=1:

    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
    

    What's wrong with my setup?

    mfalkviddM 1 Reply Last reply
    0
    • benyaB benya

      Setup:

      • Raspberry Pi serial gateway.
      • Node on Arduino Nano. Bare minimum code.

      Problem:
      Node fails to register when neither NODE_ID or MY_NODE_ID defined. It registers fine when MY_NODE_ID defined explicitly.

      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);
      }
      

      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 with MY_NODE_ID=AUTO:

      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 with MY_NODE_ID=1:

      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
      

      What's wrong with my setup?

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @benya it looks to me like AUTO has been redefined from 255 to 0. Could you check if there are any redefine warnings in the compile output? Adding a Serial.println(AUTO) in before() might help to check the value as well. Or try to set the node ID to the value 255.

      benyaB 1 Reply Last reply
      0
      • H Offline
        H Offline
        hek
        Admin
        wrote on last edited by
        #3

        Did you use the node for something else earlier? Like a gateway? Try clearing EEPROM to get rid of old settings.

        1 Reply Last reply
        1
        • mfalkviddM mfalkvidd

          @benya it looks to me like AUTO has been redefined from 255 to 0. Could you check if there are any redefine warnings in the compile output? Adding a Serial.println(AUTO) in before() might help to check the value as well. Or try to set the node ID to the value 255.

          benyaB Offline
          benyaB Offline
          benya
          wrote on last edited by
          #4

          @mfalkvidd I added

          #if MY_NODE_ID==255
          #error MY_NODE_ID==255
          #endif
          

          And compiler reported

          dummy_mysensor:16: error: #error MY_NODE_ID==255
           #error MY_NODE_ID==255
            ^
          exit status 1
          

          So MY_NODE_ID is 255.

          Yes, I cleared EEPROM as well.

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hek
            Admin
            wrote on last edited by
            #5

            Did you use the provided clear sketch or do a clear yourself? If the latter, node that you should write 0xff to all positions.

            F benyaB 2 Replies Last reply
            0
            • H hek

              Did you use the provided clear sketch or do a clear yourself? If the latter, node that you should write 0xff to all positions.

              F Offline
              F Offline
              flopp
              wrote on last edited by
              #6

              You can confirm that you have Cleared the EEPROM by opening the Serial Monitor and see what happens

              1 Reply Last reply
              0
              • H hek

                Did you use the provided clear sketch or do a clear yourself? If the latter, node that you should write 0xff to all positions.

                benyaB Offline
                benyaB Offline
                benya
                wrote on last edited by
                #7

                @hek That was it. Got node registered after clearing with 0xff.
                Thanks a lot! :joy:

                1 Reply Last reply
                1

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                11

                Online

                12.0k

                Users

                11.2k

                Topics

                113.4k

                Posts


                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                • Login

                • Don't have an account? Register

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