MQTT publish JSON string specification

I want to use the builtin MQTT broker, but I was unable to write attributes via the broker to the specific topic according to the wiki, but the subscription worked well. For example, I have an attribute named writeAttribute, which I want to modify via MQTT. My topic is this: master/client123/writeattributevalue/writeAttribute/47zcya1vaCLWmwkiPGMmdW, how should I formulate the JSON poyload? I tried like this: {"writeAttribute":23} but it did not work.

You don’t have to send JSON, only sending the number is sufficient: 23

Also if you are using MQTT explorer to initially test writing data you have to use the MQTT client id they show in the advanced tab when you are on the MQTT connection page.

2 Likes