Wait until certain time

Hi
I want to have a node which waits for a certain time of the day (e.g. wait until 07:15) , so similar as the "wait until" node but to be defined as time of the day and not a waiting time in sec, min or what ever.
How could this be implemented? Tx - JJ

This is my first attempt at helping with a question, so pardon me if this does not suit your purpose.

Will this do?

[{"id":"dc4b6debfedd4f51","type":"inject","z":"c83d72886d5b02c0","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start","payload":"schedule1","payloadType":"str","x":170,"y":70,"wires":[["ac710bce85890ac2"]]},{"id":"ac710bce85890ac2","type":"cronplus","z":"c83d72886d5b02c0","name":"@ 07:15","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 15 7 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":380,"y":160,"wires":[[]]},{"id":"77049032345f5f2d","type":"inject","z":"c83d72886d5b02c0","name":"Stop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stop","payload":"schedule1","payloadType":"str","x":130,"y":240,"wires":[["ac710bce85890ac2"]]}]

Please define what you mean by 'wait'. What is to happen to messages received before that time? What is to happen when a message is received after that time?

Could you use a delay node and use a function node before it to calculate the number of seconds you need the message to wait before it is time? this calculated number could then be assigned to msg.delay, which would then delay the message until the required time.

create a timestamp of your time of day with moment node.
Then, for example, you can calculate the difference to now and use delay.

thank you all for your swift replies. Appreciate it.
Just saw a simple solution to this: using the "wait until" node and compare the state of sensor.time from HA with the requested time of the day to wait for.
So far, this looks to be working. JJ

[{"id":"03b7a98c0c145c0d","type":"ha-wait-until","z":"7ed51af36ab4bc6e","name":"","server":"a11aa034.815b8","version":0,"outputs":2,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"19:39","valueType":"str","timeout":"10","timeoutType":"num","timeoutUnits":"minutes","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":297.2000045776367,"y":578.0000333786011,"wires":[["109cf48a5bbc8a5f"],[]]},{"id":"a11aa034.815b8","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
1 Like

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