Restful switch is_on_template parsing, Gira X1

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 :slight_smile: ?

Thank you!

Kind regards
Sascha

As a workaround you could just use the knx Integration to communicate with the X1 over a group address.

yes, I thought of that too, but where would be the learning effect :upside_down_face:

Right!
Upside of using knx would be that the X1 can request the current state from HA eg. after reboot.

That’s a good point I have not considered yet. Will make it so and leave the upskilling on JSON parsing for later.

Thank you!