node-red-contrib-error-on-timeout v1.2.4
node-red-contrib-error-on-timeout
Node red contribution node that triggers an error if a second message has not been received within a configurable timeframe.

Usage
This node receives at first a message with the eot_trigger property set and then starts the delay until a message with the eot_input flag arrives.
Warning
This node is not suitable for high frequency message processing. It is meant to help control the flow by checking a command / acknowledgement pattern such as switching equipment on and off. See my use case.
Dead lock
Once the node receives a message with the eot_trigger flag set, it'll be waiting for a message with the eot_input flag and won't accept any more trigger messages untile the configured timeout has been triggered.
Outputs
1) Success output: All messages that have arrived within the configured timeframe 2) Error output: When no message arrives within the configured timeframe 3) Late output: All messages that arrived after the configured timeframe
Programmatic configuration of the timeout interval
The message with the eot_trigger property can have a eot_timeout property set to the desired interval in milliseconds.
Latency stats
The following properties/fields are added to the messages coming out of each individual output of the node:
| Output | Fields |
|---|---|
| Success | eot_timeout Configured timeout in millisecondseot_time Time in milliseconds it took until the expected message arrived |
| Error | topic is set to error-on-timeoutpayload Formatted error message reading Input message not received within ${timeout} mseot_trigger A copy of the message that triggered the timer that resulted in the timeout |
| Late | eot_timeout Configured timeout in millisecondseot_time Time in milliseconds it took until the late message arrivedeot_late Late time in milliseconds |
My use case
I'm working on an IoT project running on MQTT where successfull execution of commands is crucial. After sending a command to a device I needed to ensure that the command has been executed successfully by having the device send out an ack message within a certain timeframe before turning on other heavy duty equipment (and potentially blow up the entire infrastructure).
sequenceDiagram
Actor Node Red
Actor Selenoid
Actor Pump
Node Red->>Selenoid: Open
Selenoid->>Node Red: ACK
Node Red->>Pump: Run
Pump->>Node Red: ACKThe default nodes that come with Node Red seemed to be too... redundant for my needs and I preferred to develop something simple and concise and wrap it into a node.
I sincerely do hope that you make good use of it.
Please see the examples by importing them through the Import > Examples dialog.