Get multiple values from string


#1

1) Give a description of the problem
Trying to create the ability to control my AC Zones using ST simulated switches. I am able to query and update the status of my AC unit using Web requests.
The HTTP GET returns the following…

[data:[default_name:Air Conditioner Settings, device_type:airconditioner, did:4, gid:0, has_state:0, has_subdevice_count:0, has_time_series:0, is_actuator:1, is_sensor:1, is_silent:0, last_data:
[DA:[amOn:false, enabledZones:[0, 0, 0, 0, 1, 0, 0, 0], fanSpeed:2, mode:0, tempTarget:22.0], timestamp:1636010784650]
, meta:[:], node:ACONNECT6827193EA581, shortName:Air Conditioner Settings, subDevices:[:], tags:aircon, vid:2], error:null, id:0, result:1]

I want to pull the 8 numbers from enabledZones:[#,#,#,#,#,#,#,#] which can be either 0 or 1 and store them in variables.

2) What is the expected behaviour?
I want to be able to modify only one zone leaving the remaining 7 zones in in their existing state.
‘{ “DA”: { “enabledZones”:[Zone1,Zone2,Zone3,Zone4,Zone5,Zone6,Zone7,Zone8] } }’

3) What is happening/not happening?
Using a HTTP Put will change all zones
EXAMPLE - This will turn on Zone 5 but turn off all other Zones:
‘{ “DA”: { “enabledZones”:[0,0,0,0,1,0,0,0] } }’

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
N/A


#2

Are you able to log $response.data ?


#3

Hi,
Sorry im not really sure what that means this is my first piston.
I do believe i have come up with a solution however it might not be the prettiest but it is working.