@svilenvul @m-memova
Hi Both,
Just wondering if you could quickly teach me how I can go about parsing a select piece of information from the response below. The piece I’m after is the section "power_state":0,
I want to use this as a way of checking the state of the light Switch to see if it has been turned on.
Hopefully this will help with your future endeavours when including it into the binding.
[16:51:42] openhabian@openHABianPi:~$ curl -u "USERNAME:PASSWORD" -X POST -H "
Content-Type: application/json" -d "{\"id\":42349}" https://mihome4u.co.uk/api/v1/subdevices/show
{"status":"success","time":0.03,"flags":{},"data":{"device_type":"light","id":42349,"label":"Ceiling
Light","device_id":5164,"power_state":0,"startup_mode":0,"aggregated_hourly_at":"2017-01-14T12:05:5
9.000Z","aggregated_daily_at":"2017-01-14T12:05:59.000Z","remote_id":1,"timer1_enabled":null,"timer1
_on_time":null,"timer1_off_time":null,"timer1_monday":null,"timer1_tuesday":null,"timer1_wednesday":
null,"timer1_thursday":null,"timer1_friday":null,"timer1_saturday":null,"timer1_sunday":null,"timer2
_enabled":null,"timer2_on_time":null,"timer2_off_time":null,"timer2_monday":null,"timer2_tuesday":nu
ll,"timer2_wednesday":null,"timer2_thursday":null,"timer2_friday":null,"timer2_saturday":null,"timer
2_sunday":null,"timer3_enabled":null,"timer3_on_time":null,"timer3_off_time":null,"timer3_monday":nu
ll,"timer3_tuesday":null,"timer3_wednesday":null,"timer3_thursday":null,"timer3_friday":null,"timer3
_saturday":null,"timer3_sunday":null,"extra_data":null,"target_temperature":null,"voltage":null,"vol
tage_reported_at":null,"frequency":null,"real_power":null,"reactive_power":null,"created_at":"2017-0
1-14T12:05:59.000Z","updated_at":"2017-01-14T12:15:07.000Z","nest_thermostat_id":null,"rate_limit_to
kens_used":10,"rate_limit_tokens_updated_at":"2017-04-14T18:59:23.000Z","device_groups":[{"id":38337
,"name":"Nathan \u0026 Jess Room","user_id":30732}],"today_wh":0,"today_wh_range":"low","last_data_i
nstant":0,"unknown_state?":true,"unknown_state":true}}
Thank
Nathan