MQTT Protocol Question



  • When my components arrive I plan to start with a sensor or two and a serial gateway to a pi.
    I understand my radios communicate using the mysensors protocol, taken care of in the arduino sketch.

    Now suppose I get that working and decide to implement MQTT (which seems a popular choice)
    Does MQTT run on top of the mysensors protocol or does it have its own completely different sketch.?

    Sorry if this is a daft question. For some reason this is bugging me.



  • I use Domoticz, and this have native support for Mysensors. This means that you don't have think about how it's talking to each other (Protocol), It then uses the serial gateway

    You can also install MQTT (and you need a broker too, Mosquitto) so that you can use devices that uses MQTT as protocol.
    https://www.domoticz.com/wiki/MQTT#Introduction

    It depends on your controller (controller= homeautomation controller)


  • Mod

    @grumpazoid MySensors uses a gateway to connect the MySensors network to the rest of the world, which is often a controller.
    There are various gateways supporting e.g. serial or ethernet, but there also are MQTT gateways (see the xxxMQTTClient examples here ).
    These gateways are clients, so they connect to an MQTT broker elsewhere to publish and subscribe their messages.



  • Thanks for the replies.

    To use MQTT do I need to upload a different code to the sensors?


  • Mod

    @grumpazoid in general no, the sensors will just communicate with the gateway.

    But some controllers do not support dynamic id assignment over mqtt so you might need to define MY_NODE_ID.



  • @grumpazoid The sensors themselves do not communicate with the MQTT broker. They communicate with the gateway as usual.

    The gateway then communicates with the MQTT broker, like this example.



  • @craig-thom said in MQTT Protocol Question:

    @grumpazoid The sensors themselves do not communicate with the MQTT broker. They communicate with the gateway as usual.

    The gateway then communicates with the MQTT broker, like this example.

    Thanks Craig Thom
    That makes a bit more sense now ☺



  • Update so far:
    Still using Domoticz with MS serial gateway, but have installed Mosquitto and in Domoticz I have added "MQTT Client Gateway with LAN interface".
    This allows me to control my sonoff over MQTT. Some progress at least.
    I notice that all the MySensors data is pushed out on the domoticz/out topic.
    So do I really need a MySensors MQTT gateway? I guess that would allow interception if MQTT topics for processing with something such as Node Red.
    I have just installed Node Red but have only managed to process some earthquake data (as per the example).



  • @grumpazoid You will indeed see that a changed value in Domoticz on one of your MySensor nodes will be published on the domoticz/out topic. This is because the node was presented to Domoticz at start up.
    You are not able to access a non presented node directly by Domoticz through the gateway.

    You can walk around that by creating a virtual sensor in Domoticz and a 'bridge' in Node red that translates MQTT to the MySensor.
    Check https://www.mysensors.org/controller/nodered.



  • @wimd Thanks.
    Why would I want a non presented node?
    I am guessing a Mysensors MQTT gateway will let me send and receive MQTT messages direct to/from the Mysensors network without having to rely on Domoticz?


 

170
Online

8.6k
Users

9.4k
Topics

99.1k
Posts