MySensors MQTT gateway and serial rs485 sensor node communication



  • Hi all,

    I would like to setup an sensor network with an ethernet gatway and wired connected sensor nodes. (RS485)

    Gateway: Arduino Uno R3 with W5100 ethernet shield.
    Sensor Nodes: Nodes are connected with gateway via wired rs485 connection (cable).

    Connection Flow 1 # Get sensor values:
    Arduino Sensor Node (RS485) --> Gateway --> MQTT --> OpenHab2

    Connection Flow 2 # Issue commands to sensor node: (e.g. activate relay)
    OpenHab2 --> MQTT --> Gateway --> Arduino Sensor Node (RS485)

    Is that possible with the MySensors library?
    Because the RS485 gateway example I found on this page doesnt seem to use MQTT communication to OpenHab?

    Regards,
    Simon


  • Mod

    @ehome welcome to the MySensors community!

    It should be as easy as changing

    #define MY_GATEWAY_SERIAL
    

    to

    #define MY_GATEWAY_MQTT_CLIENT
    

    and add the configuration parameters listed on the mqtt gateway page.



  • Thanks for your fast reply.

    That sounds easy.
    And you think that the communication between sensor nodes and Gateway are still possible via wired RS485?

    I tried to find an example on this site for sending Information from Gateway to sensor nodes. (via SendMessage ?)
    For example I like to Switch on/off an light that is connected to an relay board at my sensor node.

    Communcation Flow:
    OpenHab2 --> MQTT --> Gateway --> RS485 --> Sensor Node --> Relay Board

    Currently I have an working RS485 Connection between my Arduino Uno's with the use from SoftwareSerial library.
    During my testings I realized, that the message that I triy to send "Hello" will be sent to the other arduino char by char. Is that true?

    Because I tried to raise up an pin on HIGH with "if(msg == "Hello")..." But it doesn't worked.

    Will the sendMsg method from the MySensor library handle this out of the box?

    Regards,
    Simon



Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts