Sonnenbatterie with APIv2 / Webhook

Hi!

now I’m trying to set the Em_OperatingMode to manual. I can do it with this curl command:

curl -X PUT -d EM_OperatingMode=1 --header 'Auth-Token: TOKEN' http://sonnen:80/api/v2/configurations

And I get the appropriate response:

{"EM_OperatingMode":"1"}

I would like to have it as a switch though:

switch:
  - name: Sonnen battery manual mode
    platform: rest
    resource: http://sonnen:80/api/v2/configurations
    method: put
    headers:
      Auth-Token: !secret sonnen_api_token
    body_on: "EM_OperatingMode=1"
    body_off: "EM_OperatingMode=2"
    is_on_template: '{{ value_json["EM_OperatingMode"] == "1" }}'

But it doesn’t work. In the logs I only get:

ERROR (MainThread) [homeassistant.components.rest.switch] Can't turn on http://sonnen:80/api/v2/configurations. Is resource/endpoint offline?

Any clues?