Newbie question about how the mysensors gateway connects to controller



  • I read and watched a lot about mysensors, but didn't manage to learn the following.

    My question regards only the part of how the mysensors gateway (in my case: Arduino nano) connects to the controller (in my case Raspberry Pi 4 with Home Assistant Hass.io).
    It does not regard how the gateway connects to sensors (which I guess wil be wireless and probably RFM69 in my case).

    I prefer a cabled connection between the gateway and the controller.
    Maybe this is also what is recommended?

    I can imagine connecting the gateway (Nano) through an ethernet cable (via a W5100 module) to my switch/router which should make it possible for the controller to communicate with it if it is on the same network.
    Is this what you call an ethernet gateway?

    But I guess a USB cabled direct connection between the gateway (Nano) and the controller (Raspberry Pi with Hass.io) is also a technical possibility (they will probably be located next to each other anyway).
    Is this possible and is this what you call a serial gateway?

    Which is recommended?
    Are both equally good?
    I don't want to invent a new connection method.
    I just want to follow the guidelines, but got confused down the line and was afraid that the gateway needed to communicate with the controller via 2.4GHz which I hope to avoid.


  • Hero Member

    yes you are correct, the serial gateway will connect to your controllers (Hassio) serial port and the Ethernet gateway will connect over your wired network connection. Both will work well, i guess the Ethernet approach gives you the flexibility of having the gateway away from the controller if needed.

    In my setup I have two gateways, both are built on NodeMCU boards and connect via wifi. they have proven very reliable as well.



  • @Boots33
    Thanks a lot for the quick response.
    I now have my Nano running as a serial gateway and it is connected via a USB cable directly to my controller (Raspberry Pi 4 running Home Assistant / Hass.io).
    I added a local motion sensor to the Nano gateway HW and pasted the mysensors MotionSensor example code to the setup(), presentation() and loop() functions as well as to the definitions in the top of the GatewaySerial example code.
    I disabled the radio definitions as I currently have no radio capability in my gateway (not sure if this was necessary).
    In Home Assistant / Hass.io I updated the configuration.yaml with the following text (as described on the Home Assistant integration help):

    mysensors:
    gateways:
    - device: '/dev/ttyUSB0'

    And it works 🙂
    In Home Assistant Developer Tools under States I can now see my motion sensor go on and off by the flick of my hand.

    I had expected a bit more bumps on the road just to get this far, but wow - I am obviously walking in the foot prints of people who have worked hard to make it easy for the rest of us.
    I am sure I will hit bumps on the way when the radios have to send results to the gateway (thick concrete walls with lots of steel), but for now I will enjoy this big success.

    Thanks again Boots33



Suggested Topics

12
Online

11.4k
Users

11.1k
Topics

112.7k
Posts