how to have 2 gateways?



  • I have a nrf24 gateway running on a raspberry pi zero for a couple of years and I was playing around with creating a esp8266/nrf24 one as a replacement but I was playing around and debugging a new node when after a day or 2 noticed all my existing nodes connected to the new gateway. So now all my data got dumped into a different mqtt topic and influx DB. Is there a way to have a live "production" gateway and a "dev" one at the same time without that happening? both gateways seem to use node_id 0 and setting it differently doesn't seem to work


  • Mod

    @SylvainMartin use a different radio channel for the two networks. Define MY_RF24_CHANNEL.

    Documentation: https://www.mysensors.org/apidocs/group__RF24SettingGrpPub.html#gafb356a7718f74a37f2081fb636dfacd2



  • @mfalkvidd Thanks for the tip! Worked perfectly


  • Mod

    Nice work @SylvainMartin, thanks for reporting back.



  • @SylvainMartin I have been doing this recently, splitting security sensors on one channel and other sensors/actuators on a different one.

    It worked OK to start with but then I had issues. It may be to do with the way each individual controller handles things, but I am currently testing with adding

    #define MY_NODE_ID xxx   //where xxx is a node id not in use by any other nodes on any gateway/channel.
    

    on the second gateway, just to eliminate issues. So far the problems have gone away and I have not had a single reboot fail either. It might be worth trying if you run into problems.

    Also worth pointing out to those who might try this is that you can't have the same node id on different gateways. If gateway 1 has a node 12 registered to it then you can't have another node 12 on gateway 2 as this also seems to mess things up!


  • Mod

    @skywatch a MySensors gateway will always have node id 0. That cannot be changed.

    It is definitely possible to reuse the same node id on different MySensors networks. It could be that your controller has problems, but I know Domoticz supports multiple networks without problems.



  • @mfalkvidd said in how to have 2 gateways?:

    @skywatch a MySensors gateway will always have node id 0. That cannot be changed.

    So how does the controller differentiate between which gateway, or does it not need to? This bit has been bugging me for a while now and might explain one last oddity (but not one that causes any issues). In mycontroller I see a 'node 0' in the nodes list and this is the first gateway in the list, but the second one doesn't show due to it also being node 0 and there can only be one node with a given EUI in the listing it seems.

    Still learning after all these years!

    It is definitely possible to reuse the same node id on different MySensors networks. It could be that your controller has problems, but I know Domoticz supports multiple networks without problems.

    OK, so I will try again with this one day and see if it was just me having a bad day (not that uncommon sadly).


  • Mod

    @skywatch I don't have any experience with MyController unfortunately. In Domoticz, each gateway is added as a separate entity, with a separate name, and all nodes on that network are associated with their gateway entity.

    Each gateway has a different USB port, ip address, tcp port, mqtt topic prefix or something else that will uniquely identify it to the controller.



  • @mfalkvidd Thank you - I will ask on the mycontroller forum about this as it is something I can't find info on and it puzzles me a bit!

    When I add #define MY_NODE_ID to a gateway sketch what happens? Does it get ignored by the compiler or is it overruled by the MS library?


  • Mod

    @skywatch quickest way to find out is to try. I think there will be an error printed on debug when the gateway starts up.



  • @mfalkvidd said in how to have 2 gateways?:

    @skywatch quickest way to find out is to try. I think there will be an error printed on debug when the gateway starts up.

    I have been trying it for days now. The gateway compiles and works in as far as it connects to the controller. It is not passing traffic from nodes, but then all nodes are looking for parent id 0 and not parent is 200 (which is what I used).

    Maybe today I will reflash a node for parent 200 and see if it works, so far I think it will! πŸ˜‰



  • @skywatch

    When I add #define MY_NODE_ID to a gateway sketch what happens? Does it get ignored by the compiler or is it overruled by the MS library?

    I assigned 99 to a GW and it seems to ignore it.

    Serial output:

    73 TSM:INIT:TSP OK
    75 TSM:INIT:GW MODE
    77 TSM:READY:ID=0,PAR=0,DIS=0
    

    MQTT:

    mytest-out/0/255/0/0/18-2.4.0-alpha
    mytest-out/0/255/3/0/11-ESP dualRF Gateway
    mytest-out/0/255/3/0/12-1.0
    

    Also, I have currently 3 separate MQTT gateways configured in HA. All my nodes use static IDs and some IDs are used in multiple networks. As far as I can tell, messages in both directions are always directed to the right GW. At least I didn't notice anything go wrong so far.



  • @BearWithBeard thanks - that is useful to know. I will try again with this soon, but today is another project! πŸ˜‰


Log in to reply
 

Suggested Topics

  • 4
  • 4
  • 9
  • 15
  • 17
  • 9

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts