I am trying to get NR to turn on certain lights when motion is detected and then reset to only the lights that were on originally after a certain amount of time. Everything appears to work fine until the call service to restore the lights. The debug panel shows what looks like the right format, but there aren’t any changes to the lights. Any help is much appreciated!
[{"id":"ae6f9097019c1af2","type":"api-call-service","z":"b285421eadfe0b19","name":"Restore","server":"8700ef86.5382e","version":5,"debugenabled":true,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","output_location":"payload","output_location_type":"msg","x":940,"y":800,"wires":[[]]},{"id":"148ece0b28649cb6","type":"change","z":"b285421eadfe0b19","name":"get flow SavedStates","rules":[{"t":"set","p":"payload","pt":"msg","to":"savedStates","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":800,"wires":[["ae6f9097019c1af2"]]},{"id":"aa39f72928e8f180","type":"delay","z":"b285421eadfe0b19","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":520,"y":800,"wires":[["148ece0b28649cb6"]]},{"id":"117cf70f87bdadd7","type":"api-call-service","z":"b285421eadfe0b19","name":"Turn On","server":"8700ef86.5382e","version":5,"debugenabled":true,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.outside_lights_security"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":360,"y":800,"wires":[["aa39f72928e8f180"]]},{"id":"a70fda4d57a3f694","type":"change","z":"b285421eadfe0b19","name":"Clear Payload","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"running","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":800,"wires":[["117cf70f87bdadd7"]]},{"id":"daba18d1b0b3c0d0","type":"change","z":"b285421eadfe0b19","name":"","rules":[{"t":"set","p":"savedStates","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":740,"wires":[["a70fda4d57a3f694"]]},{"id":"c0dc56c8c2e64d5b","type":"function","z":"b285421eadfe0b19","name":"Transform","func":"const payload = {};\npayload.domain = msg.payload.entity_id.split('.')[0];\npayload.service = `turn_${msg.payload.state}`;\npayload.data = { entity_id: msg.payload.entity_id };\n\n// create a blank message object with out new payload\nmsg = { payload: payload };\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":740,"wires":[["daba18d1b0b3c0d0"]]},{"id":"f78c76049c955476","type":"ha-get-entities","z":"b285421eadfe0b19","name":"Get Switch ID","server":"8700ef86.5382e","version":0,"rules":[{"property":"entity_id","logic":"includes","value":"switch.back_porch_flood_2,switch.garage_flood_2,switch.back_porch_lantern_2,switch.front_porch_lantern_2,switch.garage_lantern_2, switch.front_porch_light_2","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":720,"y":740,"wires":[["c0dc56c8c2e64d5b"]]},{"id":"eaf3ab7429d85be7","type":"time-range-switch","z":"b285421eadfe0b19","name":"Time Check","lat":"33.459290","lon":"-96.728156","startTime":"dusk","endTime":"sunrise","startOffset":0,"endOffset":0,"x":350,"y":660,"wires":[["f78c76049c955476"],["067e70ef560b12df"]]},{"id":"067e70ef560b12df","type":"time-range-switch","z":"b285421eadfe0b19","name":"Time Check Prev","lat":"33.459290","lon":"-96.728156","startTime":"dusk","endTime":"sunrise","startOffset":"-1440","endOffset":"-1440","x":470,"y":740,"wires":[["f78c76049c955476"],[]]},{"id":"613ba70fca8990de","type":"mqtt in","z":"b285421eadfe0b19","name":"MQTT In Motion","topic":"BI/+/+","qos":"0","datatype":"auto-detect","broker":"b037538b448c98a9","nl":false,"rap":true,"rh":0,"inputs":0,"x":160,"y":720,"wires":[["eaf3ab7429d85be7"]]},{"id":"8700ef86.5382e","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":true,"heartbeatInterval":"10","statusSeparator":"","enableGlobalContextStore":false},{"id":"b037538b448c98a9","type":"mqtt-broker","name":"Mosquitto","broker":"127.0.0.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]