MQTT subscribe - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: MQTT subscribe (/showthread.php?tid=1759) |
RE: MQTT subscribe - FatMax - 31.01.2024 It looks like all the examples run inside the resident script. I would like to be able to send something through a separate function that is not in the resident script. Do you have an example I can use, or nudge me in a direction? RE: MQTT subscribe - admin - 31.01.2024 First script here: https://kb.logicmachine.net/integration/mqtt-client/ RE: MQTT subscribe - FatMax - 31.01.2024 I am testing the resident script with 0 sleep interval. It works fine, I receive messages and send messages through tagged grp objects. But let's say I have another function running in a script outside of this resident script. Code: function sendToMqtt(message) How can I accomplish this without opening a new connection? RE: MQTT subscribe - admin - 31.01.2024 Just create a new connection, it's much easier this way. RE: MQTT subscribe - FatMax - 31.01.2024 Yes, it is easy. But wouldn't this affect speed and performance? Let's consider 200 objects changing value within 5 seconds and I want all that data pushed up outside of the resident script scope? RE: MQTT subscribe - admin - 31.01.2024 Then use a resident script. The script can modified with an additional callback function per object (similar to mqtt_to_object_conv, but in reverse). It will transform the object value the way you needed before publishing it to MQTT. RE: MQTT subscribe - FatMax - 31.01.2024 (31.01.2024, 13:23)admin Wrote: Then use a resident script. The script can modified with an additional callback function per object (similar to mqtt_to_object_conv, but in reverse). It will transform the object value the way you needed before publishing it to MQTT. I am sending large amount of data generated from functions. I can not store the data in an object and therefore need to send it directly to the mqtt broker. RE: MQTT subscribe - admin - 31.01.2024 Use a separate connection for publishing then. |