Trying to capture and restore light state with scene, but it doesn't always work

So I’m trying to toggle some lights, then make sure the original state gets restored. Based on some posts here, I’m attempting to use scenes to do this, as the toggles themselves didn’t always get it right. The states are not consistently restored. Am I missing some logic?

[{"id":"6aec677d.ee5778","type":"server-state-changed","z":"acfcee4c.04ce6","name":"Walkway motion","server":"61a3b09d.8395a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.walkway_motion_motion","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,"x":100,"y":1300,"wires":[["aae804da.116238"],[]]},{"id":"5b8617f1.b6bd38","type":"api-current-state","z":"acfcee4c.04ce6","name":"Get lanai lights state","server":"61a3b09d.8395a","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.lanai_lights","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":530,"y":1380,"wires":[["e36991fa.c9053"]]},{"id":"85c1e169.d150a","type":"api-current-state","z":"acfcee4c.04ce6","name":"Get side yard lights state","server":"61a3b09d.8395a","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.side_yard_lights","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":540,"y":1460,"wires":[["255fd317.b04f7c"]]},{"id":"2fd36be3.fa1184","type":"comment","z":"acfcee4c.04ce6","name":"Flash Outside Lights on Motion","info":"","x":150,"y":1260,"wires":[]},{"id":"53636bf3.900584","type":"api-current-state","z":"acfcee4c.04ce6","name":"Max wind gust below 10?","server":"61a3b09d.8395a","version":1,"outputs":2,"halt_if":"10","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.westbay_weather_wind_gust","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":500,"y":1300,"wires":[["4d5cc264.8c9bac"],[]]},{"id":"4d5cc264.8c9bac","type":"api-current-state","z":"acfcee4c.04ce6","name":"Max wind speed below 10?","server":"61a3b09d.8395a","version":1,"outputs":2,"halt_if":"10","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.westbay_weather_wind_speed","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":770,"y":1300,"wires":[["e3e8d4b7.728998"],[]]},{"id":"e36991fa.c9053","type":"api-call-service","z":"acfcee4c.04ce6","name":"Toggle lanai lights","server":"61a3b09d.8395a","version":1,"debugenabled":false,"service_domain":"switch","service":"toggle","entityId":"switch.lanai_lights","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":760,"y":1380,"wires":[["c61a946f.5c70f8"]]},{"id":"255fd317.b04f7c","type":"api-call-service","z":"acfcee4c.04ce6","name":"Toggle side yard lights","server":"61a3b09d.8395a","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.side_yard_lights","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":790,"y":1460,"wires":[["9d37befd.1570f"]]},{"id":"aae804da.116238","type":"throttle","z":"acfcee4c.04ce6","name":"Throttle 30s","throttleType":"time","timeLimit":"30","timeLimitType":"seconds","countLimit":0,"blockSize":0,"locked":false,"x":280,"y":1300,"wires":[["53636bf3.900584"]]},{"id":"5b63adaa.4d1774","type":"counter-loop","z":"acfcee4c.04ce6","name":"Loop 6 times","counter":"iled92a63fd53358","counterType":"msg","reset":false,"resetValue":"value-null","initial":0,"initialType":"num","operator":"eq","termination":"6","terminationType":"num","increment":1,"incrementType":"num","x":300,"y":1380,"wires":[["5b8617f1.b6bd38"],[]]},{"id":"c61a946f.5c70f8","type":"delay","z":"acfcee4c.04ce6","name":"","pauseType":"delay","timeout":"750","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1380,"wires":[["5b63adaa.4d1774"]]},{"id":"25740f70.f57c6","type":"counter-loop","z":"acfcee4c.04ce6","name":"Loop 6 times","counter":"il1cddca3b3a52d6","counterType":"msg","reset":false,"resetValue":"value-null","initial":0,"initialType":"num","operator":"eq","termination":"6","terminationType":"num","increment":1,"incrementType":"num","x":300,"y":1460,"wires":[["85c1e169.d150a"],["9d0fe5c8.0451c8"]]},{"id":"9d37befd.1570f","type":"delay","z":"acfcee4c.04ce6","name":"","pauseType":"delay","timeout":"750","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1460,"wires":[["25740f70.f57c6"]]},{"id":"e3e8d4b7.728998","type":"api-call-service","z":"acfcee4c.04ce6","name":"Store light scene","server":"61a3b09d.8395a","version":1,"debugenabled":false,"service_domain":"scene","service":"create","entityId":"","data":"{\"scene_id\":\"flash_outside_lights_on_motion\",\"snapshot_entities\":[\"switch.lanai_lights\",\"light.side_yard_lights\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1020,"y":1300,"wires":[["5b63adaa.4d1774","25740f70.f57c6"]]},{"id":"9d0fe5c8.0451c8","type":"delay","z":"acfcee4c.04ce6","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":490,"y":1540,"wires":[["45d3f277.2424ac"]]},{"id":"45d3f277.2424ac","type":"api-call-service","z":"acfcee4c.04ce6","name":"Restore light scene","server":"61a3b09d.8395a","version":1,"debugenabled":false,"service_domain":"scene","service":"turn_on","entityId":"scene.flash_outside_lights_on_motion","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":700,"y":1540,"wires":[[]]},{"id":"61a3b09d.8395a","type":"server","z":"","name":"Home Assistant","addon":true}]