Hello,
I am fairly new to Node Red and am having an issue with a couple of Home Assistant (core-2021.11.5 & Node Red 10.1.1) automations and hope someone can help me with them.
The first one is controlling an outlet for Christmas lights where it turns on at sunset and turns off at 11PM local time. I have been able to make I work but the next day, the flow does not run since it apparently keeps the previous day's sunset date/time. How do I reset the flow so that it runs each day? I tried using an inject node that runs everyday at noon local time but that did not reset the sunset day/time. Here's the flow for this one:
[{"id":"80e5c09cabdc5a7e","type":"tab","label":"Christmas Lights Automation","disabled":false,"info":"","env":[]},{"id":"76b387f8456e71b9","type":"api-call-service","z":"80e5c09cabdc5a7e","name":"Turn On Front Door Outlet","server":"9e5c2d85.48958","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.front_door_outlet","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":450,"y":280,"wires":[["937544f029962cb8"]]},{"id":"abbecd906ef132f5","type":"time-range-switch","z":"80e5c09cabdc5a7e","name":"Sunset to 11PM","lat":"28.4188","lon":"-81.5818","startTime":"sunset","endTime":"23:00","startOffset":0,"endOffset":0,"x":420,"y":160,"wires":[["76b387f8456e71b9"],[]]},{"id":"72f0313ee1c2e9d0","type":"api-call-service","z":"80e5c09cabdc5a7e","name":"Turn Off Front Door Outlet","server":"9e5c2d85.48958","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.front_door_outlet","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":280,"wires":[[]]},{"id":"937544f029962cb8","type":"ha-wait-until","z":"80e5c09cabdc5a7e","name":"Wait until 11PM","server":"9e5c2d85.48958","version":0,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"23:00","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":false,"x":700,"y":160,"wires":[["72f0313ee1c2e9d0"]]},{"id":"b92068bca65a5b7a","type":"server-state-changed","z":"80e5c09cabdc5a7e","name":"Christmas Automation On?","server":"9e5c2d85.48958","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.christmas_lights_auto","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":160,"wires":[["abbecd906ef132f5"],[]]},{"id":"9e5c2d85.48958","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}]
The second one deals with turning on an LED light in the kitchen from 10PM to sunrise. I can get it to turn on each night but it doesn't turn off at sunrise. I'm sure this is not the most elegant way or event the right way to do it but I want to turn on the kitchen LED strip if the kitchen light is off and it's after 10PM local time and turn the LED off at sunrise the next day. If the kitchen light is turned on after 10PM local, turn the LED light off which then should be turned back on after the kitchen light is turned off for the hours between 10PM local and sunrise the next day. Here's that flow.
[{"id":"38ba2ab7bd5fa30b","type":"tab","label":"Kitchen LED Light","disabled":false,"info":"","env":[]},{"id":"69031d2cf2a77670","type":"server-state-changed","z":"38ba2ab7bd5fa30b","name":"Kitchen Light Off","server":"9e5c2d85.48958","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.kitchen","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":120,"wires":[["9851d1e1c0e59cdf"],[]]},{"id":"9851d1e1c0e59cdf","type":"time-range-switch","z":"38ba2ab7bd5fa30b","name":"10PM to Sunrise","lat":"28.4188","lon":"-81.5818","startTime":"22:00","endTime":"sunrise","startOffset":0,"endOffset":0,"x":370,"y":120,"wires":[["bbb8c148f41b0366"],[]]},{"id":"bbb8c148f41b0366","type":"api-call-service","z":"38ba2ab7bd5fa30b","name":"Turn Kitchen LED Lights On","server":"9e5c2d85.48958","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.kitchen_led_lights","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":620,"y":120,"wires":[["230cf9ea605c5a53"]]},{"id":"477fadcc7a16675c","type":"api-call-service","z":"38ba2ab7bd5fa30b","name":"Turn Kitchen LED Lights Off","server":"9e5c2d85.48958","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.kitchen_led_lights","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":240,"wires":[[]]},{"id":"ba3b25789a6eaf10","type":"server-state-changed","z":"38ba2ab7bd5fa30b","name":"Kitchen Light On","server":"9e5c2d85.48958","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.kitchen","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":340,"wires":[["515cac025cc019b4"],[]]},{"id":"515cac025cc019b4","type":"time-range-switch","z":"38ba2ab7bd5fa30b","name":"10PM to Sunrise","lat":"28.4188","lon":"-81.5818","startTime":"22:00","endTime":"sunrise","startOffset":0,"endOffset":0,"x":370,"y":340,"wires":[["bf11d14f84e07303"],[]]},{"id":"bf11d14f84e07303","type":"api-call-service","z":"38ba2ab7bd5fa30b","name":"Turn Kitchen LED Lights Off","server":"9e5c2d85.48958","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.kitchen_led_lights","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":620,"y":340,"wires":[[]]},{"id":"230cf9ea605c5a53","type":"ha-wait-until","z":"38ba2ab7bd5fa30b","name":"Wait until Sunrise","server":"9e5c2d85.48958","version":0,"outputs":1,"entityId":"sun.sun","entityIdFilterType":"exact","property":"attributes.rising","comparator":"is","value":"true","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":false,"x":870,"y":120,"wires":[["477fadcc7a16675c"]]},{"id":"9e5c2d85.48958","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}]
Appreciate any help. I've read through the sun events node and looked through the sites for similar questions but am coming short on how to do this simple automation properly.
Thanks!