Dear community,
I’m stuck with integrating a restful switch properly. Context: I would like to make my KNX system ‘vacation-aware’ but connecting Google Calendar and a Gira X1 via Home Assistant. To do so, I would like to call the restful API of a Gira X1, switch / API resource configuration below.
The integration:
- platform: rest
name: "Urlaub"
resource: https://A.B.C.D/api/values/a0bs?token=XXXX
verify_ssl: false
body_on: '{ "value": "1" }'
body_off: '{ "value": "0" }'
is_on_template: "{{ value_json['values']['value'] }}"
Calling the URL / API via cURL or browser returns the following JSON:
{"values":[{"uid":"a0bs","value":"1"}]}
This is the related log entry, updated when trying to set vacation mode:
2021-03-28 09:08:00 ERROR (MainThread) [homeassistant.components.rest.switch] Can’t turn on https://A.B.C.D/api/values/a0bs?token=XXXX. Is resource/endpoint offline?
I do believe the is_on_template parsing
is wrong and believe it may have to do with nested array. Unfortunately, I am NO expert on JSON though and so far I have not found the right syntax to get it parsed properly. Anyone mind giving me a nudge ?
Thank you!
Kind regards
Sascha