Lisa
Lisa

Reputation: 675

How to check if an mqtt output node is receiving messages for every certain period of time in node red

in my node-red flow , i have a mqtt output node that is subscribing to a topic .Actually for every 5 seconds a message is being published to that toipc from other client.my intension is to check if the message is not arrived for every 5 seconds ,then trigger an event . is there any node that checks if an mqtt node is getting message for every certain period of time

Upvotes: 0

Views: 533

Answers (2)

Arlemi
Arlemi

Reputation: 443

I can't think of any built-in node that does that. You can use the trigger node that does just that as @hardillb pointed it out in his answer.

One workaround could have been:

  • Have a global context variable set to true every time the MQTT node receives a message
  • Have an inject node triggered every 5 seconds (can be configured in the repeat section of the node) that checks if the global variable value is true
    • if yes then sets it back to false
    • if no raises an error saying the message wasn't received

Upvotes: 1

hardillb
hardillb

Reputation: 59751

The core Trigger node can be reset by a new incoming message and will only send it's timeout if a new message does not arrive after that time.

enter image description here

Upvotes: 1

Related Questions