Node "delay" doesn't work as expected anymore

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?


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

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.

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

This is my node:

[{"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.

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.

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.

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

1 Like