I would like to use JSON with a MQTT Client Device, but can’t find out how to publish data to a MQTT topic using a MQTT Client Device configured with JSON data format. Is there a manual, instruction, or someone in the knowledge that can explain this to me? Thanks!
I think I have to execute some PHP script when the MQTT Client Device is triggered, but from that point I’m lost.
then you need to bind this device to the correct gateway if you have more than one mqtt instance, type in the topic and choose as type „string“ (yes, string NOT json)
i have written a module that makes it possible to send data without creating an MQTT-Device instance
It is in Beta, if you want to install it, you need to type in the symcon store the name „simple MQTT sending Tool“ exactly.
Now you can create a instance and bind it to your Symcon mqtt-server-instance… If you have more than one MQTT server instance, you must add one for each instance.
After that, you can send json like this:
SMST_sendJson(integer $InstanzID, string $Topic, array $Payload); # sends an array to the topic, the json_encoding is done in the function.
// example:
SMST_sendJson(12345,'dummy/topic/set/',array("variable" => true));
or string like that
SMST_sendString(integer $InstanzID, string $Topic, string $Payload); # sends a string to the topic
// example:
SMST_sendString(12345,'dummy/topic/set/','restart');