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. Noob : Cant get Sensor talking to gateway

Noob : Cant get Sensor talking to gateway

Scheduled Pinned Locked Moved Troubleshooting
38 Posts 7 Posters 5.0k Views 6 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.
  • A Offline
    A Offline
    angeloS
    wrote on last edited by angeloS
    #1

    Hey all,

    This is my first Mysensors adventure and I cant seem to get things working..

    I have a trivially simple sketch, just to test its working but the arduino doesnt event get to my "loop".. Im baffled.. i think im doing something wrong software wise but... bafled.. Oh I know the arduino is on 2.1.1 and the Pi on 2.2.0-rc.1 but I cant work out how to burn the same version to the arduino....

    thanks in advance
    Angelo

    
    #include <SPI.h>
    #define MY_DEBUG
    #define CHILD_ID_TEMP 1
    #define MY_RADIO_NRF24
    #include <MyConfig.h>
    #include <MySensors.h>
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    void presentation()  
    { 
      // Send the sketch version information to the gateway
      sendSketchInfo("AngelosTesting", "1.1");
      present(CHILD_ID_TEMP, S_TEMP);
    }
    
    void setup()
    {
      Serial.println("Init");  
    }
    void loop()      
    {  
      
        Serial.println("Sending data");
        send(msgTemp.set("42!"));
        sleep (5000);
    }
    

    However the sensor just says "fail",.. what is interesting that when the sensor says its failure message the gateway does receive something but.. the sensor doesnt like it..

    Arduino Mini Pro sensor

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSM:FPAR
    16 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2025 !TSM:FPAR:NO REPLY
    2027 TSM:FPAR
    2029 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4038 !TSM:FPAR:NO REPLY
    4040 TSM:FPAR
    4042 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4636 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    4642 TSF:MSG:FPAR OK,ID=0,D=1
    6051 TSM:FPAR:OK
    6051 TSM:ID
    6053 TSM:ID:REQ
    6057 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    8065 TSM:ID
    8065 TSM:ID:REQ
    8069 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    10076 TSM:ID
    10076 TSM:ID:REQ
    10080 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    12089 TSM:ID
    12089 TSM:ID:REQ
    12093 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    14102 !TSM:ID:FAIL
    14104 TSM:FAIL:CNT=1
    14106 TSM:FAIL:PDT
    

    Raspberry Pi Gateway

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-rc.1
    mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-rc.1
    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: Listening for connections on 0.0.0.0:5003
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=255
    mysgw: TSF:CKU:OK,FCTRL
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=255
    mysgw: TSF:PNG:SEND,TO=0
    mysgw: TSF:CKU:OK
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    
    M 1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      You need to assign a node ID on your sensor node

      1 Reply Last reply
      0
      • A angeloS

        Hey all,

        This is my first Mysensors adventure and I cant seem to get things working..

        I have a trivially simple sketch, just to test its working but the arduino doesnt event get to my "loop".. Im baffled.. i think im doing something wrong software wise but... bafled.. Oh I know the arduino is on 2.1.1 and the Pi on 2.2.0-rc.1 but I cant work out how to burn the same version to the arduino....

        thanks in advance
        Angelo

        
        #include <SPI.h>
        #define MY_DEBUG
        #define CHILD_ID_TEMP 1
        #define MY_RADIO_NRF24
        #include <MyConfig.h>
        #include <MySensors.h>
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        void presentation()  
        { 
          // Send the sketch version information to the gateway
          sendSketchInfo("AngelosTesting", "1.1");
          present(CHILD_ID_TEMP, S_TEMP);
        }
        
        void setup()
        {
          Serial.println("Init");  
        }
        void loop()      
        {  
          
            Serial.println("Sending data");
            send(msgTemp.set("42!"));
            sleep (5000);
        }
        

        However the sensor just says "fail",.. what is interesting that when the sensor says its failure message the gateway does receive something but.. the sensor doesnt like it..

        Arduino Mini Pro sensor

        0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
        4 TSM:INIT
        4 TSF:WUR:MS=0
        12 TSM:INIT:TSP OK
        14 TSM:FPAR
        16 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
        2025 !TSM:FPAR:NO REPLY
        2027 TSM:FPAR
        2029 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
        4038 !TSM:FPAR:NO REPLY
        4040 TSM:FPAR
        4042 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
        4636 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
        4642 TSF:MSG:FPAR OK,ID=0,D=1
        6051 TSM:FPAR:OK
        6051 TSM:ID
        6053 TSM:ID:REQ
        6057 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
        8065 TSM:ID
        8065 TSM:ID:REQ
        8069 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
        10076 TSM:ID
        10076 TSM:ID:REQ
        10080 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
        12089 TSM:ID
        12089 TSM:ID:REQ
        12093 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
        14102 !TSM:ID:FAIL
        14104 TSM:FAIL:CNT=1
        14106 TSM:FAIL:PDT
        

        Raspberry Pi Gateway

        mysgw: Starting gateway...
        mysgw: Protocol version - 2.2.0-rc.1
        mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-rc.1
        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: Listening for connections on 0.0.0.0:5003
        mysgw: MCO:BGN:STP
        mysgw: MCO:BGN:INIT OK,TSP=1
        mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
        mysgw: TSF:MSG:BC
        mysgw: TSF:MSG:FPAR REQ,ID=255
        mysgw: TSF:CKU:OK,FCTRL
        mysgw: TSF:MSG:GWL OK
        mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
        mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
        mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
        mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
        mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
        mysgw: TSF:MSG:BC
        mysgw: TSF:MSG:FPAR REQ,ID=255
        mysgw: TSF:PNG:SEND,TO=0
        mysgw: TSF:CKU:OK
        mysgw: TSF:MSG:GWL OK
        mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
        mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
        
        M Offline
        M Offline
        manutremo
        wrote on last edited by
        #3

        @Angelo-Santagata the log parser is useful in these situations.

        https://www.mysensors.org/build/parserlink text

        In your case, it calls my attention that the gw seems to be answering the requests for an ID from the node with an empty payload. I would start the investigation here.

        For a check, assign an static node Id to the node and try see what happens.

        1 Reply Last reply
        1
        • A Offline
          A Offline
          angeloS
          wrote on last edited by
          #4

          thanks for the pointer guys, I'll check this out when I get home..

          1 Reply Last reply
          0
          • R Offline
            R Offline
            r-nox
            wrote on last edited by
            #5

            If you have used this same sensors as a test in the past you may need to clear the eeprom data also.

            Just a guess...

            A 1 Reply Last reply
            0
            • R r-nox

              If you have used this same sensors as a test in the past you may need to clear the eeprom data also.

              Just a guess...

              A Offline
              A Offline
              angeloS
              wrote on last edited by
              #6

              @manutremo thanks, I have used the parselink text utility but I should have paid more attention
              mm Ive used the same hardware but never got it working. .. your right maybe its stored a dud nodeID.. Looking at the docs https://www.mysensors.org/download/sensor_api_20 I can set a nodeID manually.. I'll give that a go

              1 Reply Last reply
              0
              • R Offline
                R Offline
                r-nox
                wrote on last edited by
                #7

                Here's the clear eeprom sketch if you need it.

                https://github.com/mysensors/MySensors/blob/master/examples/ClearEepromConfig/ClearEepromConfig.ino

                A 1 Reply Last reply
                0
                • R r-nox

                  Here's the clear eeprom sketch if you need it.

                  https://github.com/mysensors/MySensors/blob/master/examples/ClearEepromConfig/ClearEepromConfig.ino

                  A Offline
                  A Offline
                  angeloS
                  wrote on last edited by
                  #8

                  @r-nox AWESOME! thank you!

                  Nice to see this OS library is well supported... cool

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    angeloS
                    wrote on last edited by
                    #9

                    @manutremo , you hit it bang on.. The NODE_ID wasnt being sent, setting a node id to a number using
                    #define MY_NODE_ID 42
                    worked.

                    Curious, so I can debug this myself in the future, which line indicated the NODE_ID was blank?
                    was it this line?
                    mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:

                    M 1 Reply Last reply
                    0
                    • A angeloS

                      @manutremo , you hit it bang on.. The NODE_ID wasnt being sent, setting a node id to a number using
                      #define MY_NODE_ID 42
                      worked.

                      Curious, so I can debug this myself in the future, which line indicated the NODE_ID was blank?
                      was it this line?
                      mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:

                      M Offline
                      M Offline
                      manutremo
                      wrote on last edited by
                      #10

                      @Angelo-Santagata happy to know that you got it working. Yes I think that's the line which in the log parser showed an empty payload. It would be interesting to know why the gw is returning an empty payload when an ID is requested, though, since that's not usual behavior with the default settings. Let us know what you find out!

                      1 Reply Last reply
                      0
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #11

                        If there is no controller assigning an ID, the gw can't make up one out of nothing. 😀

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          manutremo
                          wrote on last edited by
                          #12

                          That's certainly the most probable cause, Angelo didn't mention any controller so I assumed there is one... which controller are you using (if any) Angelo?

                          1 Reply Last reply
                          0
                          • gohanG Offline
                            gohanG Offline
                            gohan
                            Mod
                            wrote on last edited by
                            #13

                            There could be a controller but if it is not assigning any ID is it just as it wasn't any 😁

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              manutremo
                              wrote on last edited by
                              #14

                              Yes, the fact that it works with a static node id seems to point in that direction - should that not be the case, i sincerely wouldn't have a clue on where to look at.

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                angeloS
                                wrote on last edited by
                                #15

                                Hi all,

                                ok this is the embarrassing bit, no the controller wasnt attached.. Im using home assistant and what I didnt realise that was that a) the controller sends the IDs and b) the controller couldnt talk to the Gateway..

                                BTW Why do we need a controller to assign the unique sensor IDs? I thought the Gateway would do this?

                                mfalkviddM 1 Reply Last reply
                                0
                                • A angeloS

                                  Hi all,

                                  ok this is the embarrassing bit, no the controller wasnt attached.. Im using home assistant and what I didnt realise that was that a) the controller sends the IDs and b) the controller couldnt talk to the Gateway..

                                  BTW Why do we need a controller to assign the unique sensor IDs? I thought the Gateway would do this?

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

                                  @Angelo-Santagata the gateways are designed to be stateless. The stateless design makes it easy to implement a gateway on low-power hardware. It also makes it easier to correctly implement and verify the gateway functionality, and to troubleshoot if there are problems. If gateways had to remember which ids had been assigned, they would no longer be stateless.

                                  A 1 Reply Last reply
                                  0
                                  • mfalkviddM mfalkvidd

                                    @Angelo-Santagata the gateways are designed to be stateless. The stateless design makes it easy to implement a gateway on low-power hardware. It also makes it easier to correctly implement and verify the gateway functionality, and to troubleshoot if there are problems. If gateways had to remember which ids had been assigned, they would no longer be stateless.

                                    A Offline
                                    A Offline
                                    angeloS
                                    wrote on last edited by angeloS
                                    #17

                                    @mfalkvidd thanks, very impressive this mySensors stuff BTW

                                    mfalkviddM 1 Reply Last reply
                                    1
                                    • A angeloS

                                      @mfalkvidd thanks, very impressive this mySensors stuff BTW

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

                                      @angeloS thanks. I agree. I can't take credit for it though, most of the stuff was designed before I found the project :)

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        manutremo
                                        wrote on last edited by
                                        #19

                                        Mistery solved :satisfied:

                                        1 Reply Last reply
                                        0
                                        • mfalkviddM Offline
                                          mfalkviddM Offline
                                          mfalkvidd
                                          Mod
                                          wrote on last edited by
                                          #20

                                          Does anyone have suggestions on a clearer log message? One that would make it easy to understand what is happening? If we could make the log clearer, other people could understand the reason quicker, saving time and frustration.

                                          A 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          20

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          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