22.02.2021, 08:10
Check the latest log entry, it shows what data was published to the topic named "100". Modify the ON_MESSAGE callback function to execute actions based on the received payload:
You can use MQTT explorer (http://mqtt-explorer.com/) to connect to LM and send any data to any topics to test your scripts.
Code:
mclient.ON_MESSAGE = function(mid, topic, payload)
log('ON_MESSAGE ', topic, payload)
if topic == '100' then
if payload == "11" then
grp.write('0/0/1', true)
elseif payload == "10" then
grp.write('0/0/1', false)
end
end
end
You can use MQTT explorer (http://mqtt-explorer.com/) to connect to LM and send any data to any topics to test your scripts.