JSON payload in MQTT message
-
Hi there, hope someone can point e in the right direction with this. I'd like to modify the mqtt client in a way that it posts json payloads containing the sensor id and possibly other information in the message. Where and how would I go for this?
Thanks, jjk
-
You could modify the protocol file found here:
https://github.com/mysensors/MySensors/blob/development/core/MyProtocolMySensors.cpp
-
thanks for the lead, I will check into that!
-
Do you mind if I ask what are you trying to do? I'm just curious
-
I don't mind at all
The idea is to post the sensor data to an uninformed controller/service, possibly web-based. Currently, the service would need to know what sensors are available and subscribe to the corresponding mqtt topics to get the sensor value as the message. I'd like it to simply subscribe to the top-level mystt topic and get all necessary information (like sensor id etc. ) in the actual message. There might be other ways to do this, I'm just experimenting and using a json container seems like a clean solution.
-
Maybe you could take a look at how they implemented the mysensors mqtt plugin in other controllers without reinventing the wheel
-
no intention to reinvent anything that is proven and works
If you could kindly point me in the right direction for an example, I am more than happy to rely on what's available!
-
Have you already looked at github? https://github.com/search?utf8=✓&q=mysensors+plugin
-
I have not, but will now
thanks!
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Home Assistant/MySensors quirks
Development • 17 Mar 2025, 02:35 • OldSurferDude 17 Mar 2025, 02:35 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51 -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23 -
PJON and Minicore not working
Development • 21 Mar 2025, 19:51 • Trand 21 Mar 2025, 19:51