Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Bug Reports
  3. ESP8266MQTTClientGateway

ESP8266MQTTClientGateway

Scheduled Pinned Locked Moved Bug Reports
mqttgatewayesp8266
8 Posts 3 Posters 2.9k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbj
    wrote on last edited by
    #1

    I am not sure this is a bug or an intentional change of the MQTT message structure.

    The version 1.5 Gateway has the code:

    inline MyMessage& build (MyMessage &msg, uint8_t destination, uint8_t sensor, uint8_t command, uint8_t type, bool enableAck) {

    while the ESP8266MQTTClientGateway uses:

           snprintf_P(_fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, PSTR(MY_MQTT_PUBLISH_TOPIC_PREFIX "/%d/%d/%d/%d/%d"), message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type);
    

    The disadvantage is of course that when upgrading to the ESP8266MQTTClientGateway a lot of coded definitions in for example Openhab have to be changed (I have no experience of how other controllers will handle this).

    YveauxY 1 Reply Last reply
    0
    • M mbj

      I am not sure this is a bug or an intentional change of the MQTT message structure.

      The version 1.5 Gateway has the code:

      inline MyMessage& build (MyMessage &msg, uint8_t destination, uint8_t sensor, uint8_t command, uint8_t type, bool enableAck) {

      while the ESP8266MQTTClientGateway uses:

             snprintf_P(_fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, PSTR(MY_MQTT_PUBLISH_TOPIC_PREFIX "/%d/%d/%d/%d/%d"), message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type);
      

      The disadvantage is of course that when upgrading to the ESP8266MQTTClientGateway a lot of coded definitions in for example Openhab have to be changed (I have no experience of how other controllers will handle this).

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by Yveaux
      #2

      @mbj said:

      inline MyMessage& build (MyMessage &msg, uint8_t destination, uint8_t sensor, uint8_t command, uint8_t type, bool enableAck) {
      

      This is the build-method used to create a message to be sent over the MySensors network, while this

      snprintf_P(_fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, PSTR(MY_MQTT_PUBLISH_TOPIC_PREFIX "/%d/%d/%d/%d/%d"), message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type);
      

      is the creation of the format string to convert a message to MQTT topic...

      Two different things.

      What is your real issue?

      http://yveaux.blogspot.nl

      M 1 Reply Last reply
      0
      • YveauxY Yveaux

        @mbj said:

        inline MyMessage& build (MyMessage &msg, uint8_t destination, uint8_t sensor, uint8_t command, uint8_t type, bool enableAck) {
        

        This is the build-method used to create a message to be sent over the MySensors network, while this

        snprintf_P(_fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, PSTR(MY_MQTT_PUBLISH_TOPIC_PREFIX "/%d/%d/%d/%d/%d"), message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type);
        

        is the creation of the format string to convert a message to MQTT topic...

        Two different things.

        What is your real issue?

        M Offline
        M Offline
        mbj
        wrote on last edited by
        #3

        @Yveaux Thank's for a quick reply. The current message (1.5) shows up with type (like V_TEMP) in third position in the received message at the Openhab end. Item def thus is something like MyMQtt/24/1/V_TEMP:state:default.

        The received message from new version as sniffed by a MQTT.fx client is MyMQTT/24/1/1/0/V_TEMP which thus means a rewrite of all definitions in Openhab.

        YveauxY 1 Reply Last reply
        0
        • M mbj

          @Yveaux Thank's for a quick reply. The current message (1.5) shows up with type (like V_TEMP) in third position in the received message at the Openhab end. Item def thus is something like MyMQtt/24/1/V_TEMP:state:default.

          The received message from new version as sniffed by a MQTT.fx client is MyMQTT/24/1/1/0/V_TEMP which thus means a rewrite of all definitions in Openhab.

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #4

          @mbj Ok, got it.
          Maybe @hek can explain why the format changed.

          http://yveaux.blogspot.nl

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #5

            @Yveaux said:

            Maybe @hek can explain why the format changed.

            It was due to space requirement (all V-types had to be stored as strings) and maintenance reasons (no changes needs to be done in the MQTT driver when adding a new V-types). Also the "new" topic follows the serial protocol (including internal commands) which should make it easier for controller developers to support both MQTT and serial protocol.

            M 1 Reply Last reply
            0
            • hekH hek

              @Yveaux said:

              Maybe @hek can explain why the format changed.

              It was due to space requirement (all V-types had to be stored as strings) and maintenance reasons (no changes needs to be done in the MQTT driver when adding a new V-types). Also the "new" topic follows the serial protocol (including internal commands) which should make it easier for controller developers to support both MQTT and serial protocol.

              M Offline
              M Offline
              mbj
              wrote on last edited by
              #6

              @hek Thank's for the info. I have missed any discussions about the change but as I am sure I am not the only one please add some text about the new format as a comment to the sketch whenever convenient. Might save some calls for support :-)

              1 Reply Last reply
              0
              • hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #7

                It has been posted here:
                http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway

                M 1 Reply Last reply
                0
                • hekH hek

                  It has been posted here:
                  http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway

                  M Offline
                  M Offline
                  mbj
                  wrote on last edited by
                  #8

                  @hek That was very visible, please excuse my ignorance. Even though I have looked at this page I managed to leave the change unnoticed.

                  1 Reply Last reply
                  1
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  12

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.1k

                  Posts


                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • MySensors
                  • OpenHardware.io
                  • Categories
                  • Recent
                  • Tags
                  • Popular