Set gateway NODE_ID to something else than 0



  • Hi,

    I have an arduino with an ethernet shield with 3 DS18B20 and a relay. I don't need any other sensors, so i want to connect this arduino to the controller (Jeedom). Since V2, we can connect sensors on the Gateway so my configuration should be good.

    It seems that a gateway has always a NODE_ID=0. The problem is that Jeedom does not accept 0 as an ID for the node. But i can't find a way to force the ID to anything else than 0. #define MY_NODE_ID 12 for example. In the logs of what the controller receive, I always have a NODE_ID=0.

    How can i force another value for NODE_ID ? If it is not possible using parameters, which file of the library should i modify to force the NODE_ID to what i need even if it is a gateway ?

    Thanks for your help

    Matz


  • Mod

    @matz I think you are in for a lot of pain/learning unfortunately. All routing is built on the root node (=the gateway) of the routing tree having id 0. And whenever the MySensors library is updated, you'd have to re-apply and test all your changes.


  • Mod

    @matz I agree with @mfalkvidd. The correct way to solve this would be to adapt jeedom to support 0 as node ID.
    This way all mySensors users can benefit and your solution will be future proof.



  • 😰 Ok, so I have 3 options :

    • Adapt jeedom : very difficult because i'm sure they don't accept node 0 for a reason and i would have to change the way it works with nodes

    • Adapt mySensors : it sounds to me easier but not future proof

    • Buy a new arduino to act as gateway and plug a radio on both of them

    The third one seems to be the simpler, even if it is frustrating 🙂

    I have 2 more questions if you can help :

    1. Which file in mySensors library is setting 0 to a gateway NODE_ID ? I could not find it. I just want to try modify it and see what happens

    2. In v2 of MySensors, the library accept sensors on the gateway. But it seems that a sensor node with 0 as NODE_ID is confusing the existing controllers : i've seen some posts on that concerning MyNodes or pimatic. I have tested MyNodes and it can't detect my sensors on the gateway either, though it can connect to the gateway with no problem. Would it be possible in future versions of mySensors to consider having the node_id of the gateway to be anything else than 0 ?


  • Mod

    @matz said in Set gateway NODE_ID to something else than 0:

    Which file in mySensors library is setting 0 to a gateway NODE_ID ? I could not find it. I just want to try modify it and see what happens

    I looked a bit earlier today but wasn't able to find anything conclusive. I don't think there is one place to change, there are probably many places since using nodeid id 0 for the gateway is so fundamental to MySensors. But I don't have any experience messing with the core so I might not be a good judge.

    In v2 of MySensors, the library accept sensors on the gateway. But it seems that a sensor node with 0 as NODE_ID is confusing the existing controllers : i've seen some posts on that concerning MyNodes or pimatic. I have tested MyNodes and it can't detect my sensors on the gateway either, though it can connect to the gateway with no problem. Would it be possible in future versions of mySensors to consider having the node_id of the gateway to be anything else than 0 ?

    Everything is possible, as long as someone is motivated, has the skills and time, and can make the changes without breaking (too much) stuff for other users.

    To me it would be more natural for controllers to stop blocking use of node id 0 though.


  • Admin

    Have to agree on fixing this on the controller side as it might very well be expect gateway commands (request for node id, gateway version etc) to be hardcoded to node 0. So it might still not work if you update it in the library

    You'd have to update the library code in the following places (might be more):

    https://github.com/mysensors/MySensors/blob/development/core/MyMessage.cpp#L42
    https://github.com/mysensors/MySensors/blob/development/core/MySensorsCore.h#L76


  • Mod

    @matz said in Set gateway NODE_ID to something else than 0:

    • Adapt jeedom : very difficult because i'm sure they don't accept node 0 for a reason and i would have to change the way it works with nodes

    Well, you could at least try 🙂

    Would be interesting to know why, at least.



  • It makes sens that the controller should adapt themselves and manage the NODE_ID 0. But i just don't have the skills to adapt Jeedom to do so. I could try to play with MySensors lib, but both solution are a waste of time as I would have to change the code each time the controller or the lib has a new version.

    I will have an independant node and a gateway and wait lie this for the controller to manage node_id 0

    Thank you again for answering me.

    Matz


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 1
  • 6

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts