MQTT customEvents - Invalid data

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
James83
Posts: 16
Joined: Thursday 28 November 2019 0:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

MQTT customEvents - Invalid data

Post by James83 »

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:

Code: Select all

osCommand ( 'mosquitto_pub' .. ' -h '  .. MQTTBrokerIP .. ' -t '  .. MQTTTopic .. " -m '" .. '{"command" : "customevent", "event" : "MQTTPingEvent" , "data" : "Online"}'.."'")
and triggers

Code: Select all

     on = {        
        customEvents = {
            'MQTTPingEvent',
         }
But this message gets recieved and shown in the logs but has an error and does not trigger the customEvents script:

Code: Select all

osCommand ( 'mosquitto_pub' .. ' -h '  .. MQTTBrokerIP .. ' -t '  .. MQTTTopic .. " -m '" .. '{"command":"customevent","event":"MQTTPingEvent","data":"{\"'..deviceName..'\":\"Online\"}"}'.."'")
Logs:

Code: Select all

MQTT: Topic: domoticz/slave/out, Message: {"command":"customevent","event":"MQTTPingEvent","data":"{"GSM Ellen (Ping)":"Online"}"
Error: MQTT: Invalid data received!
What im i missing?
RPI4, Philips Hue, Tradfri, Sonoff, MQTT, Zigbee2Mqtt, RFXCom 433, Octoprint,...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest