I have built a flow for a motion sensor and part of it is to turn on lights when someone goes down the stairs in the morning. I have it set so that the lights come on if the sensor is activated between 06:00 and sunrise + x minutes. This worked fine when the sun rose after 06:00 but when sunrise is before 06:00 this breaks and the time range is from 06:00 to sunrise the following day.
Please could someone help me with a way to account for this in the flow so that the when sunrise + x minutes is before 06:00 then the flow works properly?
The flow is as follows:
[{"id":"8f4879fb.49f7c8","type":"time-range-switch","z":"426f7057.3f65","name":"06:00 - sunrise + 44","lat":"52.2566","lon":"0.0705","startTime":"06:00","endTime":"sunrise","startOffset":0,"endOffset":"44","x":740,"y":1320,"wires":[["d0939ea3.c5d8a"],[]]},{"id":"d80f7e0a.c63cb","type":"link out","z":"426f7057.3f65","name":"link from stairs motion sensor","links":["76277dab.c2a7b4"],"x":1095,"y":1320,"wires":[]},{"id":"d0939ea3.c5d8a","type":"api-call-service","z":"426f7057.3f65","name":"set stairs sensor","server":"5a2e6e11.51fca8","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.stairs_sensor","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":1320,"wires":[["d80f7e0a.c63cb"]]},{"id":"8ef58a72.e32628","type":"api-current-state","z":"426f7057.3f65","name":"is it cloudy?","server":"5a2e6e11.51fca8","version":1,"outputs":2,"halt_if":"cloudy","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"weather.home","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":530,"y":1320,"wires":[["8f4879fb.49f7c8"],["f9357042.3de84"]]},{"id":"f9357042.3de84","type":"api-current-state","z":"426f7057.3f65","name":"is it rainy?","server":"5a2e6e11.51fca8","version":1,"outputs":2,"halt_if":"rainy","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"weather.home","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":520,"y":1380,"wires":[["8f4879fb.49f7c8"],["787dddb8.44d664"]]},{"id":"787dddb8.44d664","type":"time-range-switch","z":"426f7057.3f65","name":"06:00 - sunrise + 29","lat":"52.2566","lon":"0.0705","startTime":"06:00","endTime":"sunrise","startOffset":0,"endOffset":"29","x":740,"y":1380,"wires":[["d0939ea3.c5d8a"],[]]},{"id":"5a2e6e11.51fca8","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Thanks