MQTT customEvents - Invalid data
Posted: Saturday 11 September 2021 23:36
Hi,
I run a ping script on one domoticz instance and want the data to be send to another domoticz instance on another Pi by MQTT with the customEvents command. I don't want to use the remote server plugin, because i need the data to be sent immediately after the ping happened.
The message gets recieved but with invalid data and does not trigger the script.
I tried a lot of different combinations of the " , ' and \ but i must be overlooking something.
Can anyone point me in the right direction?
This example works:
and triggers
But this message gets recieved and shown in the logs but has an error and does not trigger the customEvents script:
Logs:
What im i missing?
I run a ping script on one domoticz instance and want the data to be send to another domoticz instance on another Pi by MQTT with the customEvents command. I don't want to use the remote server plugin, because i need the data to be sent immediately after the ping happened.
The message gets recieved but with invalid data and does not trigger the script.
I tried a lot of different combinations of the " , ' and \ but i must be overlooking something.
Can anyone point me in the right direction?
This example works:
Code: Select all
osCommand ( 'mosquitto_pub' .. ' -h ' .. MQTTBrokerIP .. ' -t ' .. MQTTTopic .. " -m '" .. '{"command" : "customevent", "event" : "MQTTPingEvent" , "data" : "Online"}'.."'")
Code: Select all
on = {
customEvents = {
'MQTTPingEvent',
}
Code: Select all
osCommand ( 'mosquitto_pub' .. ' -h ' .. MQTTBrokerIP .. ' -t ' .. MQTTTopic .. " -m '" .. '{"command":"customevent","event":"MQTTPingEvent","data":"{\"'..deviceName..'\":\"Online\"}"}'.."'")
Code: Select all
MQTT: Topic: domoticz/slave/out, Message: {"command":"customevent","event":"MQTTPingEvent","data":"{"GSM Ellen (Ping)":"Online"}"
Error: MQTT: Invalid data received!