Lost beginner - nodes, parent nodes and changes needed to sketches ?



  • Hi all,

    I'm trying to get OpenHAB working in a test environment. I've built a serial gateway on an Arduino uno and used the GatewaySerial sketch.

    I can add this as a Thing to OpenHAB by specifying the serial device and it shows as 'Online' in the Things view.

    I'm now trying to add a switch which is an Arduino nano with a radio and a relay running the RelayActuator example sketch. Nothing is discovered, so I've chosen 'Manually Add Thing' and then chosen Switch.

    In the switch menu, it prompts me for a node ID and a child node ID.

    What values should I be using for these? And what do I need to change in my RelayActuator sketch for the device to have this info available ?

    Thanks,


  • Mod

    You need to assign node ID in sketch, did you defined it?



  • I've got a MY_NODE_ID assigned. But what should I be setting for the Child Node ID in my sketch to correspond to this value in OpenHAB ?


  • Mod

    Each sensor in a node has a child ID (look at the examples) so I guess that is the number you are looking to specify in Openhab when adding a new thing



  • @anonymouslemming I am still using openhab 1. it never assigned device ID's automatically. So I set them manually and burned them to the ROM. There are sketches here to do this. So in principle you start withe node -1- write thet to ROM and the burn the sketch to it in 2nd step.
    If you add more nodes later, you just number them and make sure they are unique.
    For the child id, it is easier, this is within the sketch. Usually the first is 0
    If you have a node with one switch it should be 0 if not specified differently. All sample sketches are this way.
    If you build a more complex with e.g. a temp, humidity and light sensor the child id's will become 0, 1, 2

    Ok?

    Btw: if you have the node connected to the serial console you should see that information. Post your debug output if still in doubt

    SJ



  • I've taken OpenHAB out of the equation for the moment in the hopes of simplifying things. I'm just trying to get the 2 radios to connect.

    I'm lost as to the actual syntax I should be using to set node IDs and sensor IDs.

    On my serial gateway, I get the following when plugging it in:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.1.1
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    

    That looks about right to me.

    On the sensor (light switch) device, I see the following when plugging it in:

    TSM:INIT
    TSM:RADIO:OK
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    

    From what I can tell, that means that the connection from the Arduino to the radio is good and the radio is healthy, but it's not being able to connect to anything.

    I'm lost as to what part of the examples I should be including here to get these to connect.


  • Mod

    make sure #define MY_NODE_ID 3 and all other mysensors related defines are written before the #include <MySensors.h>



  • @gohan said in Lost beginner - nodes, parent nodes and changes needed to sketches ?:

    make sure #define MY_NODE_ID 3 and all other mysensors related defines are written before the #include <MySensors.h>

    I've got the following near the top of the sketch:

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    #define MY_NODE_ID 3
    #include <MySensors.h>
    

    There are no occurrences of MY_NODE_ID above this, but I'm seeing the same behaviour.

    Is this test even useful? insofar as testing radio connectivity without a gateway in place ?

    Is anyone able to share a circuit and a sketch for a simple relay that's known to work with OpenHAB, or should the examples be working ?

    thanks,


  • Mod

    What do you mean you don't have a gateway in place?



  • @gohan said in Lost beginner - nodes, parent nodes and changes needed to sketches ?:

    What do you mean you don't have a gateway in place?

    Apologies - I mean that I don't have a controller in place at the moment. I do have the serial gateway running, but no node ID variables / defines in there.



  • @anonymouslemming have you tried another arduino? I think I had once a similar issue, all was set correct but node did not connect. Changed the arduino and it worked.



  • @parachutesj said in Lost beginner - nodes, parent nodes and changes needed to sketches ?:

    @anonymouslemming have you tried another arduino? I think I had once a similar issue, all was set correct but node did not connect. Changed the arduino and it worked.

    I've tried 3 different Arduino Nano's on the switch module and 2 different radios. Replaced cables too. I tried a different Arduino Uno on the gateway module too.


  • Mod

    according to the log the node is not getting an ID otherwise it should show in the first lines that it is using ID = 3
    You could try running the cleareeprom sketch and upload your sketch again



  • I finally got this working. My problem was my radio's were not communicating. I went back to basics with an RF24 example sketch and found one of my radio's to be dead. After replacing it, I simply set
    MY_NODE_ID in my sketch and everything is now working.


  • Mod

    @anonymouslemming it is always good to have spare parts around 😄



  • @gohan I have SOOO many spare RF24's now - I bought a batch of 10 off of Amazon while debugging this.

    😄


  • Mod

    I hope yours are not the cheap crappy chinese clones like I got from Amazon too. If you paid less than 12$ for those, they most likely are too.



  • @gohan I'm almost 100% sure they're clones, yeah. But they've been going for 2 days now across the range of my house (while in low power mode - no capacitor in place yet), so they'll do for prototyping.

    Once I get to designing and printing boards, then I'll be a lot fussier 🙂


Log in to reply
 

Suggested Topics

  • 22
  • 7
  • 10
  • 132
  • 3
  • 135

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts