Not sure the complexity of your elevation check but there’s a node, eztimer, that allows you to set a time or sun based event with the option for randomization. Using this node might help simplify your flows.
Also as far as I understand it you really don’t need to check the state of the switch before sending a turn on/off service call. There shouldn’t be any ill effects.
![](//community-assets.home-assistant.io/original/3X/6/b/6bae214902aaa108647c31719348247a2731eaa0.png)
[{"id":"920d4a4f.1de438","type":"eztimer","z":"d7029474.cf9948","name":"","autoname":"dusk - sunrise","suspended":false,"sendEventsOnSuspend":false,"timerType":"1","startupMessage":true,"ontype":"1","ontimesun":"dusk","ontimetod":"17:00","onproperty":"payload","onvaluetype":"str","onvalue":"on","onoffset":"30","onrandomoffset":true,"offtype":"1","offtimesun":"sunrise","offtimetod":"dusk","offduration":0,"offproperty":"payload","offvaluetype":"str","offvalue":"off","offoffset":"30","offrandomoffset":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":144,"y":96,"wires":[["34be314f.a68f5e","9688988d.105638"]]},{"id":"34be314f.a68f5e","type":"api-call-service","z":"d7029474.cf9948","name":"Facade Lights","service_domain":"homeassistant","service":"turn_{{payload}}","data":"{\"entity_id\":\"switch.facade_lights\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":336,"y":96,"wires":[[]]},{"id":"9688988d.105638","type":"rbe","z":"d7029474.cf9948","name":"change ?","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":316,"y":144,"wires":[["2156a5f3.b504ca"]]},{"id":"2156a5f3.b504ca","type":"debug","z":"d7029474.cf9948","name":"Send to Pushbullet","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":522,"y":144,"wires":[]}]
Or if you still want to check the state of the switch before acting upon it.
[{"id":"83e528b1.bc8818","type":"eztimer","z":"d7029474.cf9948","name":"","autoname":"dusk - sunrise","suspended":false,"sendEventsOnSuspend":false,"timerType":"1","startupMessage":true,"ontype":"1","ontimesun":"dusk","ontimetod":"17:00","onproperty":"payload","onvaluetype":"str","onvalue":"on","onoffset":"30","onrandomoffset":true,"offtype":"1","offtimesun":"sunrise","offtimetod":"dusk","offduration":0,"offproperty":"payload","offvaluetype":"str","offvalue":"off","offoffset":"30","offrandomoffset":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":144,"y":208,"wires":[["fee494dd.ffde18"]]},{"id":"fee494dd.ffde18","type":"api-current-state","z":"d7029474.cf9948","name":"Facade Light","version":1,"outputs":2,"halt_if":"payload","halt_if_type":"msg","halt_if_compare":"is_not","override_topic":false,"entity_id":"switch.facade_light","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":326,"y":208,"wires":[["e2d8a826.f316d8","139807d8.2d45e8"],[]]},{"id":"e2d8a826.f316d8","type":"api-call-service","z":"d7029474.cf9948","name":"Facade Lights","service_domain":"homeassistant","service":"turn_{{payload}}","data":"{\"entity_id\":\"switch.facade_lights\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":512,"y":208,"wires":[[]]},{"id":"139807d8.2d45e8","type":"rbe","z":"d7029474.cf9948","name":"change ?","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":492,"y":256,"wires":[["50d6cf3.681113"]]},{"id":"50d6cf3.681113","type":"debug","z":"d7029474.cf9948","name":"Send to Pushbullet","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":682,"y":256,"wires":[]}]
edit: This flow should allow you to replace four flows into one.