# Temperature sensor SMS sending with delay if

**URL:** https://discourse.nodered.org/t/temperature-sensor-sms-sending-with-delay-if/88693
**Category:** General
**Created:** [14 June 2024 11:23 UTC](https://discourse.nodered.org/t/temperature-sensor-sms-sending-with-delay-if/88693 "2024-06-14T11:23:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Kralle](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@Kralle](https://discourse.nodered.org/u/Kralle)
#### Post date: [14 June 2024 11:23 UTC](https://discourse.nodered.org/t/temperature-sensor-sms-sending-with-delay-if/88693/1 "2024-06-14T11:23:33Z")

</div>

I'm new to Node Red and I'm having a little problem with my flow.

I want to monitor a cold storage facility with a temperature sensor. The temperature is -20° degrees. The temperature is allowed to rise to -10° degrees for 1 hour before an SMS is sent. If the temperature returns to -20° degrees, no SMS should be sent. I have a flow that delays the SMS for 600 seconds, but that's wrong because the cold storage door can be opened... then the temperature just drops. Anyone have an idea??

Best regards !

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [14 June 2024 11:44 UTC](https://discourse.nodered.org/t/temperature-sensor-sms-sending-with-delay-if/88693/2 "2024-06-14T11:44:52Z")

</div>

did you try a `trigger` node ? with either a switch or a simple gate node

---

<div class="post-metadata">

### Author: ![kitori](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kitori](https://discourse.nodered.org/u/kitori)
#### Post date: [14 June 2024 12:13 UTC](https://discourse.nodered.org/t/temperature-sensor-sms-sending-with-delay-if/88693/3 "2024-06-14T12:13:53Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/faad9021a66663c02bed88ce1144aae469a1ad18.png)  
Maybe like this?

The first trigger node filter the door-open-events. When the temperatur raise fast enough during the grace period, no msg ist send. The second delay node send the actual sms an blocks further sms-sending, until the temperture ist greater than the threshold.

```auto
[{"id":"ec60fc5d6e3be275","type":"inject","z":"4fe2154e6505c4c9","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-11","payloadType":"num","x":190,"y":140,"wires":[["152da39463e56613"]]},{"id":"a532d4c0eadc3217","type":"inject","z":"4fe2154e6505c4c9","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-10","payloadType":"num","x":190,"y":180,"wires":[["152da39463e56613"]]},{"id":"d23dc16cc9eb8750","type":"inject","z":"4fe2154e6505c4c9","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-9","payloadType":"num","x":190,"y":220,"wires":[["152da39463e56613"]]},{"id":"b31641981cd47204","type":"trigger","z":"4fe2154e6505c4c9","name":"","op1":"it's hot in here!","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1060,"y":180,"wires":[["d0f5892cea242033"]]},{"id":"0d2f7b054e79e8a2","type":"switch","z":"4fe2154e6505c4c9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"-10","vt":"str"},{"t":"lt","v":"-10","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":180,"wires":[["b48d9df5cd738b8f"],["5faee6f83e49a95d"]]},{"id":"d0f5892cea242033","type":"debug","z":"4fe2154e6505c4c9","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1280,"y":180,"wires":[]},{"id":"5faee6f83e49a95d","type":"change","z":"4fe2154e6505c4c9","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":260,"wires":[["b31641981cd47204","b48d9df5cd738b8f"]]},{"id":"b48d9df5cd738b8f","type":"trigger","z":"4fe2154e6505c4c9","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":840,"y":180,"wires":[["b31641981cd47204"]]},{"id":"152da39463e56613","type":"junction","z":"4fe2154e6505c4c9","x":380,"y":180,"wires":[["0d2f7b054e79e8a2"]]}]

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [12 September 2024 12:14 UTC](https://discourse.nodered.org/t/temperature-sensor-sms-sending-with-delay-if/88693/4 "2024-09-12T12:14:46Z")

</div>

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