Solved my problem with using a split and join node in sequence.
Not sure if it´s the proper way, but it works. :slight_smile:
My code is the following:
[{"id":"1d879771a82ea28b","type":"api-call-service","z":"2acd2bb5e7d3081f","name":"","server":"994795e5.82fb08","version":5,"debugenabled":false,"domain":"scene","service":"create","areaId":[],"deviceId":[],"entityId":[],"data":"{\"scene_id\":msg.state,\"snapshot_entities\":msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":220,"wires":[["e5934aee1306ef6c"]]},{"id":"6064c46fab3c0110","type":"api-current-state","z":"2acd2bb5e7d3081f","name":"","server":"994795e5.82fb08","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.belysningsscener","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"state","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":390,"y":160,"wires":[["516099fa1c33099e"]]},{"id":"62d4044636c5592b","type":"server-state-changed","z":"2acd2bb5e7d3081f","name":"","server":"994795e5.82fb08","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.belsyning_scenknapp","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,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":210,"y":100,"wires":[["3afa929bc44eac75"],[]]},{"id":"3afa929bc44eac75","type":"ha-get-entities","z":"2acd2bb5e7d3081f","name":"Get States","server":"994795e5.82fb08","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"light.wiz","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"data.entity_id","output_results_count":1,"x":130,"y":160,"wires":[["6064c46fab3c0110"]]},{"id":"e5934aee1306ef6c","type":"api-call-service","z":"2acd2bb5e7d3081f","name":"","server":"994795e5.82fb08","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.belsyning_scenknapp"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":960,"y":220,"wires":[[]]},{"id":"e14cd4cdd32d320c","type":"split","z":"2acd2bb5e7d3081f","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":290,"y":220,"wires":[["8a2072028a5d8ec6"]]},{"id":"516099fa1c33099e","type":"change","z":"2acd2bb5e7d3081f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"data.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":220,"wires":[["e14cd4cdd32d320c"]]},{"id":"8a2072028a5d8ec6","type":"join","z":"2acd2bb5e7d3081f","name":"","mode":"custom","build":"array","property":"payload.entity_id","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":410,"y":220,"wires":[["7d27f8531151f897"]]},{"id":"7d27f8531151f897","type":"change","z":"2acd2bb5e7d3081f","name":"","rules":[{"t":"set","p":"data.entity_id","pt":"msg","to":"payload.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":220,"wires":[["1d879771a82ea28b"]]},{"id":"994795e5.82fb08","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]