New to Node-Red and HA. Requesting Feedback on a flow

Hello everyone, I am new to hass, Node-Red and home automation. I have created a simple flow that turns on a nightlight in the evening and turns it off at sunrise. I was hoping that some of you would be able to look at the flow and suggest improvements. I was able to cobble this flow together and it works but I dont think that it is the most efficient way to complete the task. Any assistance would be appreciated.

[{"id":"ae573d8a.943b18","type":"tab","label":"2nd Floor Bathroom Nightlight","disabled":false,"info":""},{"id":"cf2b90b9.1aa1c8","type":"poll-state","z":"ae573d8a.943b18","name":"","server":"7a554823.e94b48","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"5","updateIntervalUnits":"minutes","outputinitially":false,"outputonchanged":false,"entity_id":"sun.sun","state_type":"str","halt_if":"below_horizon","halt_if_type":"str","halt_if_compare":"is","outputs":2,"x":170,"y":314,"wires":[["d87320ac.3d8938"],["d830917c.c0c7a"]]},{"id":"7cc38f42.6cb29","type":"api-call-service","z":"ae573d8a.943b18","name":"","server":"7a554823.e94b48","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.0003804224a16012def6","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":650,"y":240,"wires":[[]]},{"id":"d87320ac.3d8938","type":"timerswitch","z":"ae573d8a.943b18","name":"","ontopic":"","offtopic":"","onpayload":"","offpayload":"","disabled":false,"schedules":[{"on_h":"21","on_m":"45","on_s":"00","off_h":"07","off_m":"00","off_s":"00","valid":true}],"x":420,"y":240,"wires":[["7cc38f42.6cb29"]]},{"id":"d830917c.c0c7a","type":"api-call-service","z":"ae573d8a.943b18","name":"","server":"7a554823.e94b48","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.0003804224a16012def6","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":650,"y":320,"wires":[[]]},{"id":"7a554823.e94b48","type":"server","name":"Home Assistant","addon":true}]

Only users having installed node-red-contrib-home-assistant-websocket are able to understand your flow. So I suggest that you ask these kind of questions in the Home Assistant forum, topic integration Node-RED.

a) As the lights are simple Home Assistant entities and sunset/sunrise are Home Assistant build in events I don't see any need to use Node-RED for this case. You can use standard Home Assistant capabilies. There are several examples as Blueprints, ...

b) If you absolute want to use Node-RED for this I suggest to replace the polling for sunset/sundawn with a listening to event sunset/sunrise.

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