ESP8266MQTTClientGateway
-
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).
-
@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?
-
@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.
-
-
@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.
-
@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
-
It has been posted here:
http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway
-
@hek That was very visible, please excuse my ignorance. Even though I have looked at this page I managed to leave the change unnoticed.
Suggested Topics
-
ESP8266 crashes while starting up and receiving a message from node
General Discussion • 17 Jan 2018, 19:45 • Abdu Sahin 18 Jan 2018, 22:36 -
MQTT GW on ESP8266 supporting SSL/TLS?
Development • 4 Jun 2024, 10:21 • bgunnarb 27 Jun 2024, 13:53 -
💬 Arduino Serial Gateway for RFM69HW
OpenHardware.io • 24 Jan 2017, 12:49 • openhardware.io 8 Jun 2017, 10:06 -
CC3000 and ethernet/MQTT gateway
Hardware • 29 Jan 2015, 14:09 • bomber 6 Jan 2016, 01:20 -
MySensors Ethernet Gateway RPi form-factor (W5100 module)
OpenHardware.io • 3 Mar 2016, 08:13 • openhardware.io 3 Mar 2016, 08:13 -
Energy Pulse Meter strange behaviour
Troubleshooting • 13 Dec 2014, 14:00 • mbj 3 Jan 2015, 20:44 -
RFM69HW antenna
General Discussion • 4 Jul 2019, 13:42 • tsunami 8 Jul 2019, 09:45 -
💬 MySWeMosGWShield - WeMos Mini MySensors Gateway Shield
OpenHardware.io • 22 Dec 2016, 05:01 • openhardware.io 8 Aug 2018, 17:12