Openhab und mqtt: autoassign node IDs and howto use them



  • Hello

    I need some explanations concerning this setup:

    Node => gateway mit mqqt client => mosquitto broker => openhab

    Openhab and mosquitto are running fine. Gateway too I think.

    At the moment I have 2 items: one static mqqt pub script and one mysensor module.
    This can be seen in mosquitto:

    infrastructure/sky_state ON
    sensor-gw1-out/255/255/3/0/3 (null)
    sensor-gw1-out/255/255/3/0/3 (null)
    sensor-gw1-out/255/255/3/0/3 (null)
    
    

    The infrastructure part works and is switched in openhab. The sensor-gw1-out messages are (as far as I've understood this) are the requests from to node to get a NODE_ID

    And this is the part, where I'm clueless

    • how does openhab assign IDs to the nodes?
      IMHO openhab does not know anything about this message format and the "wish" of the node to get an ID?
    • and a resulting question, IF the node ID is assigned dynamically, how does this match with the static item configuration of openhab? Or do i have to wait, until a node ID is assigned by openhab and create the item after that? 😕 are these node id static after initial assignment? Where are they stored in order to survive a node restart? Or are dynamic nodes in my setup the wrong approach and I have to use static node IDs (which would be quite annoying 😄 )

    Thank for input 😉


  • Mod

    @dakky said:

    • how does openhab assign IDs to the nodes?

    Simple; it doesn't 😉

    IF the node ID is assigned dynamically, how does this match with the static item configuration of openhab?

    Save yourself the trouble and use static node ID's.



  • 😛 ok thats simple 😄

    How to you manage your sketches? I have a git repos with the sketches i use. This means a lot of code duplication, because now i need a sketch per node ID instead per node "type"?


  • Mod

    @dakky you could store a node's ID in its eeprom and retrieve it on start. This allows all nodes to have identical firmware.



  • @Yveaux do u have some code snipplet/example showing this ?


  • Mod

    @dakky just have a look at the api description on the MySensors home page. Everything should be in there.



  • Maybe this information should be put on the webpage for the openhab? It took quite some time to find the answer


Log in to reply
 

Suggested Topics

166
Online

9.2k
Users

9.9k
Topics

103.2k
Posts