Posts: 226
Threads: 47
Joined: Nov 2015
Reputation:
2
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?
Posts: 7839
Threads: 42
Joined: Jun 2015
Reputation:
450
Just create a new connection, it's much easier this way.
Posts: 226
Threads: 47
Joined: Nov 2015
Reputation:
2
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?
Posts: 7839
Threads: 42
Joined: Jun 2015
Reputation:
450
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.
Posts: 7839
Threads: 42
Joined: Jun 2015
Reputation:
450
Use a separate connection for publishing then.
Posts: 13
Threads: 0
Joined: May 2024
Reputation:
0
Hi There,
I am currently trying to write a single Value from a JSON Payload to an Object.
I tested JSON Parse to Lua Table by adding the Payload from my MQTT Browser to the Script and decode it. Works just fine. MQTT Payload to Objects works as well.
But my JSON is too large for a String Object. But I struggle to add the MQTT Payload to a Variable.
Does Anyone have any Ideas or experience with this?
Thanks
Posts: 51
Threads: 8
Joined: Jul 2015
Reputation:
0
How i can set my "Client ID" ?
There is a code like client:id_set(Client ID) ?
BR
Posts: 7839
Threads: 42
Joined: Jun 2015
Reputation:
450
Then you need a separate script for each device. Client id is sent once connection is established.