Mysensors mqtt gateway (noob question).



  • Hello !
    I'm a newbie on mysensors. it seems very interesting, but I was not able to fully understand how it works.

    I'm building my own weather station, based on MQTT and weewx.
    I was wondering if I could use the arduino mysensors lib to make the sensor management easier.

    I have some question regarding the MQTT gateway.

    How is the mqtt topic build exactly ?
    From my understanding and what I have see on the website, it seems to be this way:

    1/ it should be defined a topic prefix, ex mygateway1-out
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"

    2/ The sensors are published with as topic, something like this:
    mygateway1-out/x/x/x/x/x

    Is this correct ? is the xxx some kind of id ?

    Also, for an easier management and also because I use some sensors that would not use mysensors, I wish to use my own mqtt topic structure.
    Is it possible to do this using mysensors ? or shall I build my own software for MQTT management ?

    The topics I would like to use looks like this:
    /weewx/outTemp
    /weewx/rain
    etc...

    Best regards,



  • @capibara
    Yes, you are getting there!
    The topic prefix is just as you say defined by the #define statement.
    The rest of the topic is defined as described in the API definition (Serial protocol) so:
    /node-id/sensorchild-id/command/ack/type/
    The content of the message is the payload.
    Example: this is copied from my GW:
    ib9sensors-out/21/2/1/0/4 1014 => So the sensor id is 21/ the child is 2/ this is a "set" message/ no-ack/ payload type is V_PRESSURE. The content of the message is 1014 which is just the atmospheric pressure here today.
    I recommend using an MQTT client test tool like MQTT.fx It helps a lot when debugging.

    I am not the right guy to answer how to re-define the topic structure. I guess you will have to do some serious work on the MQTT GW software.


Log in to reply
 

Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.6k
Posts