MQTT publish/suscript from Script
Script programming can be used to get data from subscribed topics of publish extra topics.
Please go to the script programming manual for more information.
Script - Suscription
You can subscribe to up to 10 topics
The use read_io 1000 to get the messages on the script
read_io 1000,b,0;
b
how may messages are queued waiting to be read
To get the first message in the queue use read_str 1000
read_str 1000,c,z;
z
message text
Script - Publish
You public message straight from the script code
Go to the script programming manual for more information.
Before publishing it's suggest it to check if the broker connection is established
read_io 1001,h,0;
h
=1 connection established
Then set the topic to publish
write_str 1001,'v1/devices/me/telemetry';
And finally set the payload. This operation will also publish the message.
write_str 1002,'{A1:52}';
cLAN-MQ User Manual
Scripts - Publish/Subscribe
57 / 73
Summary of Contents for cLAN-MQ Series
Page 14: ...2020 11 19 cLAN MQ User Manual cLAN Configurator 13 73 ...
Page 22: ...Analog inputs cLAN MQ User Manual Physical Inputs Outputs 21 73 ...
Page 30: ...2020 09 28 cLAN MQ User Manual Features of power supply and inputs outputs 29 73 ...
Page 59: ...2020 11 20 cLAN MQ User Manual Scripts Publish Subscribe 58 73 ...
Page 66: ...2020 09 28 cLAN MQ User Manual cLAN2205 MQ 65 73 ...
Page 69: ...2020 09 28 cLAN MQ User Manual cLAN3404 MQ 68 73 ...