We monitor temperatures in cold stores using Node Red and Dragino LSN50 sensors. The sensors transmit every 20 minutes. I'll add a screenshot. I would now like to monitor all sensors to see whether a payload is sent at all. If not, an email should be sent after a certain time. How do you realize that??
Thank you.
You can use a Trigger node for this. Configure it to Send Nothing, wait 21 minutes, then Send the email message. Also set Extend Delay if No Message Arrives. The result is that every time a new message arrives it will restart the timer, so the email message will never be sent. If 21 minutes elapses without an input then it will send the email message.
You may want to configure an Inject node to send the trigger a message on startup to prime the timer, so that you will get your email if node-red is restarted and no data is received from the sensor.
Do you have an example?? Trigger is known. After 21 minutes, what should be in Sent then and after the trigger node just an email node??
That is up to you. If you want to send an email then put there whatever you want to send to the email node. Get that going first, using an Inject node to send it a message. Then you can easily test it just by clicking the inject. Once you have it working then you can wire it up to the Trigger.
As you are getting sensor values from MQTT, I assume that each sensor's message has a unique msg.topic.
Note that the trigger node should be set to handle each msg.topic separately.
Something like this might work. I set my trigger to 21 seconds for easy testing.
[{"id":"22beb24c8059f0a6","type":"trigger","z":"db04fd79f3a93d19","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"21","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"topic","topic":"topic","outputs":1,"x":410,"y":1180,"wires":[["5af2e306db133633"]]},{"id":"5af2e306db133633","type":"change","z":"db04fd79f3a93d19","name":"Format email","rules":[{"t":"set","p":"topic","pt":"msg","to":"topic & \" may be offline\"","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"\"Last seen \" & lastseen","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":1180,"wires":[["34b5504756faa229"]]},{"id":"7d66973cdca0b813","type":"change","z":"db04fd79f3a93d19","name":"","rules":[{"t":"set","p":"lastseen","pt":"msg","to":"$now()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":1180,"wires":[["22beb24c8059f0a6"]]},{"id":"34b5504756faa229","type":"link out","z":"db04fd79f3a93d19","name":"To email","mode":"link","links":[],"x":720,"y":1180,"wires":[],"l":true}]
I get an email with a title like sensors/temperature/door may be offline
and content Last seen 2024-09-13T12:36:11.421Z
Great Thaks for a lot of