Inject/trigger at time from an input_datetime (but only time) from HA

Hello there!
I want to trigger an automation at a specific time every day in Node-RED.
And I want to get that time from an input_datetime (only time) variable in HA.

Any ideas on how this can be done?

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/using-date-and-time-entities-to-trigger-flows.html#daily-alarm-using-datetime-entity

The timer used is ‘node-red-contrib-bigtimer’ you can add through the palette manager. The timer can be set to a schedule but can also be overridden by using a manual input. Input to this timer is set with an input-datetime entity. In the function node I have set the input overide of bigtimer node to on, but you can select as off as you wish. Hope it helps.

[{"id":"73ac36c.5ebfac8","type":"bigtimer","z":"25063fae.4f85f","outtopic":"","outpayload1":"on","outpayload2":"off","name":"Sunset lights automation","comment":"Lights automation","lat":"33.2011989","lon":"-96.9083990","starttime":"5004","endtime":"1350","starttime2":"0","endtime2":"0","startoff":"0","endoff":"0","startoff2":"","endoff2":"","offs":0,"outtext1":"","outtext2":"","timeout":"60","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":967.1428375244141,"y":2057.142910003662,"wires":[["e7024e9f.801d9"],[],[]]},{"id":"76ccca81.7f39d4","type":"inject","z":"25063fae.4f85f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":305.71431732177734,"y":2057.143171310425,"wires":[["3742d5e5.68278a"]]},{"id":"3742d5e5.68278a","type":"api-current-state","z":"25063fae.4f85f","name":"input time","server":"8a3231e1.3f0e1","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_datetime.automation_timer","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":500.0000534057617,"y":2057.142996788025,"wires":[["8f437eba.9f411"]]},{"id":"e7024e9f.801d9","type":"debug","z":"25063fae.4f85f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1218.5714416503906,"y":2042.8572664260864,"wires":[]},{"id":"6163bd42.674764","type":"debug","z":"25063fae.4f85f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930.0000457763672,"y":2131.4283962249756,"wires":[]},{"id":"8f437eba.9f411","type":"function","z":"25063fae.4f85f","name":"Combine strings","func":"\nvar overide_on = \"on_override \"; \nvar time = msg.payload\n\nvar payload = overide_on + time\n\nmsg.payload = payload\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":712.8571319580078,"y":2057.14271736145,"wires":[["6163bd42.674764","73ac36c.5ebfac8"]]},{"id":"8a3231e1.3f0e1","type":"server","name":"Hassio","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

@Kermit @bastero
Trying to understand both of you, but still finding it very hard…

Ok, please explain what is it you don’t understand and i’ll see if i can walk you through it.

Ehm ok @bastero ,
when do you trigger the injection node? And if you do this like once every second, will that slow down my pi 4?

What actually happens in the function node?

And does that override the big timer?

This may explain the thinking a bit better… This flow allows you to either schedule a time (within bigtimer, this gives you flexibility…) or as a manual input ( in format hh:mm:ss) using an input_datetime entity (you define this and enter the time from the UI)

[{"id":"73ac36c.5ebfac8","type":"bigtimer","z":"25063fae.4f85f","outtopic":"","outpayload1":"on","outpayload2":"off","name":"Default scheduled timer","comment":"This triggers the automation either based on schedule below or via manual override time ","lat":"32.2011989","lon":"-96.9083990","starttime":"720","endtime":"0","starttime2":"0","endtime2":"0","startoff":"0","endoff":"0","startoff2":"","endoff2":"","offs":0,"outtext1":"","outtext2":"","timeout":"60","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":1042.8571319580078,"y":2057.1428565979004,"wires":[["e7024e9f.801d9"],[],[]]},{"id":"76ccca81.7f39d4","type":"inject","z":"25063fae.4f85f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":305.71431732177734,"y":2057.143171310425,"wires":[["3742d5e5.68278a"]]},{"id":"3742d5e5.68278a","type":"api-current-state","z":"25063fae.4f85f","name":"input time","server":"8a3231e1.3f0e1","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_datetime.automation_timer","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":462.85720443725586,"y":2057.142873764038,"wires":[["8f437eba.9f411"]]},{"id":"8f437eba.9f411","type":"function","z":"25063fae.4f85f","name":"String concatenation ","func":"\nvar overide_on = \"on_override \"; \nvar time = msg.payload\n\nvar payload = overide_on + time\n\nmsg.payload = payload\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":732.8571319580078,"y":2057.14271736145,"wires":[["73ac36c.5ebfac8"]]},{"id":"8a3231e1.3f0e1","type":"server","name":"Hassio","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]
1 Like