Questions on Routing, Discovery, Protocol and Multiple Controllers
-
I'm looking into switching controllers (or perhaps using two controllers for a while to see which i prefer). What's worrying me is that i'm not 100% sure on what happens when i expose sensors to two gateways.
My question therefore is where can i find information on how sensors and gateways and controllers actually interact. So i can find out things like;
- is there a routing table on each sensors and is it possible for a sensor to transmit to two gateways attached to two separate controllers
- i am aware that radio is literally just a broadcast and anyone listening will hear, but will a gateway/controller 'drop' a package from a source it doesn't know? (like they have not gone trough pairing
- what is the behavior of a sensor broadcasting and receiving an ACK if there are two?
- does the controller actually do much?, i know some behavior is built into the (i'm generally using serial) gateways like sending out a discovery request on boot, does the controller keep track of ID's and assign them, or does a controller merely do responses for data that sensors ask for
- etc
I'm aware that i could just dig through the code and find this out myself but i'm hoping somebody has a write up on this or some design documentation i haven't been able to find myself yet.
Any input will be greatly appreciated!
-
Welcome to the forum @Stevanov
I don't know the answers to all your questions but I'll answer what I can.
- is there a routing table on each sensors
Sensor nodes only know their parent. The gateway and repeater nodes have routing tables.
- is it possible for a sensor to transmit to two gateways attached to two separate controllers? i am aware that radio is literally just a broadcast and anyone listening will hear, but will a gateway/controller 'drop' a package from a source it doesn't know? (like they have not gone trough pairing
A MySensors network should only have one gateway.
Controllers have no radio. Controllers always communicate through a gateway. Some controllers have a "inclusion" mode which mean it will ignore messages from all nodes that have not been added through the inclusion process.
Gateways will always forward all traffic, unless signing is used. If signing is used, the gateway will drop packets with an invalid signature. It is also possible to whitelist nodes using signing. See https://www.mysensors.org/about/signing for more infotmation.
- what is the behavior of a sensor broadcasting and receiving an ACK if there are two?
Two gateways: the behavior is undefined. All sorts of strangs things can happen. This applies to all traffic, not only ACK.
Two controllers: Depends on the controllers, and if filtering is applied between the controllers and the gateway. Some controllers have a "proxy mode" where they forward traffic to another controllers. Some people use NodeRed to filter messages (make sure only one of the controllers handle out new node IDs for example, to avoid confusion). The protocol between the controllers and the gateway makes a difference also; mqtt works different from serial.- does the controller actually do much?, i know some behavior is built into the (i'm generally using serial) gateways like sending out a discovery request on boot, does the controller keep track of ID's and assign them, or does a controller merely do responses for data that sensors ask for
Some controllers do a lot. Some controllers don't do much. MySensors supports more than 20 controllers. See https://www.mysensors.org/controller
Gateways do not send discovery requests on boot.If you use static node ID assignment, assignment is not handled by the controller.
If you use automatic node ID assignment, and a controller that supports automatic node ID assignment, the controller will be responsible for assigning node IDs.I'm aware that i could just dig through the code and find this out myself but i'm hoping somebody has a write up on this or some design documentation i haven't been able to find myself yet.
https://www.mysensors.org/about/network tries to explain the main concepts in MySensors. https://www.mysensors.org/apidocs/index.html has detailed information about specific features. https://www.mysensors.org/download/sensor_api_20 has information about the most common things a node is involved in.
-
I have two gateways (though i would like to eliminate the second) since i have two PIs running at opposite ends of the house on different floors. They both talk MQTT to openhab. For the couple of nods that can reach both GW at most I see two MQTT messages with the same data. More advanced features I can't comment on. I'm not using the OH binding on any nodes that reach more than 1 GW. Most of my nodes just provide sensor data, so duplicate data doesn't both it.
-
Thank you for the thorough reply @mfalkvidd
I already had a look the pages you linked but some of the questions I had were only partially answered by those pages so I appreciate you taking the time to answer all of them.
Judging by your answers i'm not going to try two gateways. I will instead look into building an ethernet gateway or perhaps forwarding data from one controller to the next.
Signing is definitely something i want to implement too as my gateway seems to be picking up pacakges from a mysensors user near me!
Especially your statements about undefined behaviour in regards to ACKs were helpful.
Thanks again and apologies for replying as late as i did.
-
Hi,
I'm no MySensors guru to be sure. You started by saying you were considering a second Controller. Then mentioned two Gateways.
You didn't mention what particular Controller you are using now. I've been using Domoticz for my Controller for a couple of years. Domoticz is perfectly happy to talk to multiple Gateways. I have some sensors on a MySensors radio network exposed to Domoticz through a single Mysensors Gateway. I also expose multiple ESP8266 (wifi) sensor nodes, each of which Domoticz sees as a separate Mysensors Gateway. I also have several virtual gateways collecting online data from Netatmo sensors and other online sources.
You can certainly have more than one MySensors (radio) gateway if they are on different radio types (and I believe different channels). The concern is that Mysensors radio nodes must communicate exclusively with a single Mysensors radio gateway. You can't have a gateway wander around into the area covered by another gateway unless its on a different frequency, or routing may get all mixed up. It doesn't work like Wifi or cellular where connections are handed off.
Your sensors won't get exposed to Controllers at all. Just one gateway for any node and multiple Gateways should be OK...at least for Domoticz.
Hope I got that all right.
Cheers!