Sending mqtt msg every 20 seconds


I need to send an mqtt msg every 20 second with the content based on a received input that is updated about once every 4 hours.
The input is on or off and the output 1 for on and 0 for off. Any suggestions as to the best method.



Possibly you can use a Trigger node in Resend Every .. mode.

...or you could save the input state to context using a change node.
Then set an inject node to run every 20 seconds, sending the saved context value to a MQTT node.
If you used a filesystem storage module, the saved value would survive a restart, and continue sending the last saved value.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.