Dusk to Dawn Motion Lights

Looking for help setting up some lights that are turned on when motion occurs between dusk and dawn. If the lights are turned on, they should turn off after 5 minutes.

What have you got so far?

[{"id":"37773badfaf6e6ae","type":"comment","z":"2f95c855cb2cd6a6","name":"Foyer","info":"","x":90,"y":700,"wires":[]},{"id":"4f9b444004db4091","type":"server-state-changed","z":"2f95c855cb2cd6a6","name":"Motion","server":"9405c3fe.d0a6c","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.front_door_motion","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"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":90,"y":820,"wires":[["2e8dcdd6cfb3b1ce"]]},{"id":"2e8dcdd6cfb3b1ce","type":"change","z":"2f95c855cb2cd6a6","name":"Get input_boolean state and set delays in ms","rules":[{"t":"set","p":"delay","pt":"msg","to":"$globalContext(\"homeassistant.homeAssistant.states['input_boolean.livingroomautomation'].state\")","tot":"jsonata"},{"t":"change","p":"delay","pt":"msg","from":"on","fromt":"str","to":"300000","tot":"num"},{"t":"change","p":"delay","pt":"msg","from":"off","fromt":"str","to":"1800000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":175,"y":820,"wires":[["c6706bc6f9f5beb1"]],"l":false},{"id":"691def49362778d3","type":"trigger","z":"2f95c855cb2cd6a6","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"250","extend":false,"overrideDelay":true,"units":"ms","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":495,"y":880,"wires":[["23a59c0990bed138"]],"l":false},{"id":"c6706bc6f9f5beb1","type":"switch","z":"2f95c855cb2cd6a6","name":"Automation on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":320,"y":820,"wires":[["691def49362778d3","1aa6293ff8d118e8","4d3f3a51279027a0"],["691def49362778d3"]]},{"id":"23a59c0990bed138","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light off","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.foyer_lights","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":880,"wires":[["d811913eb8003bb5"]]},{"id":"d811913eb8003bb5","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Input off?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.livingroomautomation","state_type":"str","blockInputOverrides":true,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":840,"y":880,"wires":[["48e86f7864ebebc8"],[]]},{"id":"48e86f7864ebebc8","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Input on","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"input_boolean.livingroomautomation","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":990,"y":880,"wires":[[]]},{"id":"1aa6293ff8d118e8","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light 100%","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.foyer_lights","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":720,"wires":[[]]},{"id":"4d3f3a51279027a0","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Bright Out?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"above_horizon","halt_if_type":"str","halt_if_compare":"is","entity_id":"sun.sun","state_type":"str","blockInputOverrides":false,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":610,"y":780,"wires":[[],["d1de6cfecd489518"]]},{"id":"d1de6cfecd489518","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Porch Light","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.porch_lights","data":"","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":780,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant Real","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]```

This is controlling my foyer lights and porch lights. If motion is detected outside, its first checkig a boolean to determine whether i disabled motion lights. If i didnt, i should turn the foyer light on 100% if there is motion. I should also check to see if it is after dusk but before dawn, and turn the light on if its after dusk and before dawn. The problem is it seems to always turn the porch light on with motion, even during the day.

anyone able to help with this? again, looking to trigger lights turning on with motion, but only between dusk and dawn.

Just use the “time range” node for that. You can then specify dusk and dawn dynamically so it automatically adjusts to the real dusk and dawn during the year.

will specifying between dusk and dawn in the time range node work since that will cross into the next day? do i have to use something like next sunrise or sunrise + 24 hours?

When you just try it, you can see the timings below the node like this:

image