Rest switch stopped working

Hello all,

I’m not sure exactly when the rest switch stopped working. I’m thinking it was within the past 2-3 releases of HA.

I have several rest switch is setup as follows for Dockermon:

- platform: rest
  resource: !secret obico_redis
  name: Obico Redis
  body_on: '{"state": "start"}'
  body_off: '{"state": "stop"}'
  is_on_template: '{{ value_json is not none and value_json.state == "running" }}'

When I try to turn the switch on, I get the following message in my logs.

Logger: homeassistant.components.rest.switch
Source: components/rest/switch.py:165
Integration: RESTful (documentation, issues)
First occurred: 9:07:53 AM (1 occurrences)
Last logged: 9:07:53 AM

Error while switching on http://10.4.20.55:8126/container/obico-server_ml_api_1

In the interim I created a rest_command which does successfully start and stop the service.

rest_command:
  obico_redis_start: 
    url: !secret obico_redis_start
  obico_redis_stop: 
    url: !secret obico_redis_stop

Any idea’s why the rest switch is failing to start/stop the service?

Exactly same issue here, can’t start my containers via ha-dockermon anymore since last upgrade. I am using same rest switch setup. Tried to fix by adding the header octet-stream to match the curl example of ha-dockermon but that didn’t help.

1 Like

Will take a look at this one over the next few days and update the issue on GitHub with my findings :pray:

4 Likes