# Node "delay" doesn't work as expected anymore

**URL:** <https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568>\
**Category:** General\
**Created:** [28 April 2024 19:59 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568 "2024-04-28T19:59:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cairon](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cairon](https://discourse.nodered.org/u/cairon)\
**Post date:** [28 April 2024 19:59 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/1 "2024-04-28T19:59:38Z")

</div>

Hi there,

I have an automation to turn on my coffee machine. I am using a motion sensor in the kitchen for that.

The idea was that the coffee machine gets power when I am entering the kitchen for the first time a day.

I am using a delay node for that and that worked perfectly since a few weeks.  
I am not sure but I think the node was changed from reset at midnight to reset after 24h.

May I am right here? If yes: do you know a bugfix or another node for this kind of automation?

Greets  
Daniel

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [28 April 2024 20:15 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/2 "2024-04-28T20:15:07Z")

</div>

The code of the delay node has not changed in the last 7 months, and that change would not impact this.

You can see the change history here: [History for packages/node\_modules/@node-red/nodes/core/function/89-delay.js - node-red/node-red · GitHub](https://github.com/node-red/node-red/commits/master/packages/node_modules/%40node-red/nodes/core/function/89-delay.js)

You've not said what changes (e.g. upgrades you have made in the mean time), but I would not expect this behaviour to have changed. Looking at the code it has always been 24hrs, not reset at midnight.

But there is nothing to stop you setting up a inject node to send a message with `msg.reset` set to `true` at midnight every night to reset it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 April 2024 20:49 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/3 "2024-04-28T20:49:50Z")

</div>

> [@cairon](#):
>
> I think the node was changed from reset at midnight to reset after 24h

Please show us how you have configured the delay node and explain what you mean by `reset'.

---

<div class="post-metadata">

**Author:** ![cairon](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cairon](https://discourse.nodered.org/u/cairon)\
**Post date:** [28 April 2024 21:59 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/4 "2024-04-28T21:59:33Z")

</div>

This is my node:

```auto
[{"id":"f375f22abdc47d79","type":"link in","z":"fd23194c.583248","name":"Kaffeemaschine","links":["876a7b3578423547","f7fc2843e1bc0b0a"],"x":95,"y":1340,"wires":[["4074372572de3229","b8b7edda6007f5e0"]]},{"id":"b8b7edda6007f5e0","type":"delay","z":"fd23194c.583248","name":"1x/Tag","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"day","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":210,"y":1320,"wires":[["0e0cdd13834e7669"]]},{"id":"0e0cdd13834e7669","type":"api-call-service","z":"fd23194c.583248","name":"Kaffeemaschine","server":"bf7fb19a.bb8b","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.kaffeemaschine"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":440,"y":1320,"wires":[[]]},{"id":"bf7fb19a.bb8b","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

```

I could swear that this automation was working perfect all the time and the reset to 0 was at midnight.

I need a node which resets to 0 at midnight.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [28 April 2024 22:13 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/5 "2024-04-28T22:13:20Z")

</div>

Your flow contains nodes that are not installed by default, please give us an example flow demonstrating your issue using standard default nodes.  
You will be more likely to get support, because it avoids us having to add non-standard nodes to our palettes.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [28 April 2024 23:08 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/6 "2024-04-28T23:08:23Z")

</div>

It seems surprising that your delay node is set to limit the flow to one message per day and to queue intermediate messages. You could easily be building a sizeable queue.

> [@cairon](#):
>
> I need a node which resets to 0 at midnight.

As @hardillb says, use an inject node which at midnight sends msg.reset.

---

<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:** [27 July 2024 23:08 UTC](https://discourse.nodered.org/t/node-delay-doesnt-work-as-expected-anymore/87568/7 "2024-07-27T23:08:43Z")

</div>

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