Is there logic to this? Or am I doing something wrong?

I’m fairly new to Node Red and still haven’t decided whether I like it or not…
But that’s besides the point.

I created a small flow that turns off my AC if a window are open for more than 30 seconds.
Upon detecting that a window is opened I create a scene with current AC settings. Then I turn off the AC and once all windows have been closed I “restore” the scene and delete the scene.
After a bit of debugging I think I got it to work but what confuses me is this:
When I create the scene in Node-red the scene needs a name which it gets with “scene_id” (In my case “scene_id”: “upstairs_ac”) in the data section.
When I restore the scene I get an error if I use "scene_id: “upstairs_ac” as data; instead I now need to use “device_id”: “upstairs_ac”.
Finally - when I need to delete this scene I get get an error if I use “scene_id”: “upstairs_ac”, I get an error if I use “device_id”: “upstairs_ac” but if I use “entity_id”: “scene.upstairs_ac” it appears to work!

Would love to understand the logic here.

[{"id":"e00822c838152273","type":"api-call-service","z":"efa596a04b454cf6","name":"Capture Upstair Thermostat settings","server":"abb115bd.dc6758","version":5,"debugenabled":false,"domain":"scene","service":"create","areaId":[],"deviceId":[],"entityId":[],"data":"{\t   \"scene_id\":\"upstairs_ac\",\t   \"snapshot_entities\":\"climate.nest_upstairs_2\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":700,"wires":[["8b116517cf8537e3"]]},{"id":"8b116517cf8537e3","type":"api-call-service","z":"efa596a04b454cf6","name":"Turn off Upstair AC","server":"abb115bd.dc6758","version":5,"debugenabled":false,"domain":"climate","service":"turn_off","areaId":[],"deviceId":[],"entityId":["climate.nest_upstairs_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1070,"y":700,"wires":[[]]},{"id":"ca643510f4daec0c","type":"server-state-changed","z":"efa596a04b454cf6","name":"One or more upstair windows are open","server":"abb115bd.dc6758","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.upstair_window_sensor","entityIdType":"exact","outputInitially":false,"stateType":"habool","ifState":"true","ifStateType":"bool","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"30","forType":"num","forUnits":"seconds","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":350,"y":700,"wires":[["e00822c838152273"],["5924f850df5a1b1b"]]},{"id":"5924f850df5a1b1b","type":"api-call-service","z":"efa596a04b454cf6","name":"Restore Upstair Thermostat setting","server":"abb115bd.dc6758","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\t   \"device_id\": \"upstairs_ac\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":740,"y":780,"wires":[["60673b59da398904"]]},{"id":"60673b59da398904","type":"delay","z":"efa596a04b454cf6","name":"Wait a little bit..","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":940,"y":900,"wires":[["57f34b3966d452cf"]]},{"id":"57f34b3966d452cf","type":"api-call-service","z":"efa596a04b454cf6","name":"Delete Upstair Thermostat settings","server":"abb115bd.dc6758","version":5,"debugenabled":true,"domain":"scene","service":"delete","areaId":[],"deviceId":[],"entityId":[],"data":"{\t   \"entity_id\":\"scene.upstairs_ac\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1120,"y":780,"wires":[[]]},{"id":"5fce840c3eeb40c1","type":"comment","z":"efa596a04b454cf6","name":"Handling upstair AC","info":"","x":290,"y":640,"wires":[]},{"id":"abb115bd.dc6758","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":false,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

It shouldn’t be in the data section. Use the entity section scene.upstairs_ac

image

The same thing goes for delete. However it’s not necessary to delete the scene as it is overwritten when scene create is called again.