Can't get nodeID from the controller



  • Howdy folks!
    I'm a new user of the MySensors library, however Im not new into AVRs and Arduinos 😉 I've been trying to setup 2 UNOs with two radios and MySensors - 1 controller and one sensor ( in my case just for the example purpose - door sensor). Both radios connected as instructed. First UNO (controller) flashed with the SerialGateway example code, second - the sensor with example from the webpage. If i set nodeID manually on the sensor with gw.begin, everything seems to be ok. But when I try to get nodeID from the controller, it seems sensor is trying to send following message over and over again, thus not getting nodeID from the controller.

    Sensor serial data (DEBUG mode ON):

    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    sensor started, id 255
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    req node id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
    

    Controller serial data (DEBUG mode ON)

    0;0;3;0;9;Inclusion started by button.
    0;0;3;0;5;1
    0;0;3;0;9;
    read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
    255;255;3;0;3;
    0;0;3;0;9;
    read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
    255;255;3;0;3;
    0;0;3;0;9;
    read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
    255;255;3;0;3;
    

    Sensor sketch:

    #include <MySensor.h>
    #include <SPI.h>
    #define ID 1
    #define OPEN 1
    #define CLOSE 0
    
    MySensor gw;
    MyMessage msg(ID, V_TRIPPED);
    
    void setup() 
    { 
      gw.begin();
      gw.present(ID, S_DOOR); 
    }
    
    void loop()
    {
     gw.send(msg.set(OPEN)); 
     delay(10000); // Wait 10 seconds
    }

  • Admin

    What controller do you have?



  • @hek
    Controller is an Arduino UNO, flashed with SerialGateway example.


  • Admin

    Arduino Uno is not a controller. It's running a SerialGateway. A gateway which normally talks to the controller that hand out id:s.
    So without a controller you have to have static id:s.



  • Damn, I should have read documentation more carefully 🙂 For some reason I assumed Gateway will send out nodeIDs. So now I'm going to start digging into MySensors and OpenHAB documentation.

    Thanks HEK!



  • Hi, and welcome. If it helps you, i did the same mistake, but in my case the documentation was wrong at the time.


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 5
  • 1
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts