Hi,
running HA 0.111.2 on a RPi 3B+ under Supervisor 227 on HassOS 4.10.
All current at the time of writing.
A few HA updates ago, all of my formerly working RESTful switches, controlling several ESP8266-based devices, all stopped working. I didn’t notice right away, because the switches control less-critical features on those devices.
The devices themselves work. One of them, for example, is a WeMo-compatible Power Plug. The WeMo parts works (discovery, switch, everything), but not the RESTful API that controls the LED.
Only message I get from the log:
2020-06-14 15:06:54 ERROR (MainThread) [homeassistant.components.rest.switch] No route to resource/endpoint: http://192.168.178.172/state.json
Subquestion: Any hints how to get more information from the log? Here’s part of my logger configuration (which doesn’t change a thing):
logger:
default: error
logs:
homeassistant.components.rest.switch: debug
homeassistant.components.rest.binary_switch: debug
homeassistant.components.switch: debug
homeassistant.components.binary_switch: debug
And here is one of my switch configs:
switch:
- platform: rest
name: sonoff_led_1
timeout: 45
resource: http://192.168.178.172/state.json
method: post
body_on: 'green=true'
body_off: 'green=false'
is_on_template: '{{ value_json.led }}'
headers:
Accept: text/json
Content-Type: application/x-www-form-urlencoded
On POST, the device’s interface takes form-urlencoded POST parameters, and returns JSON in the response’s body. Here’s an example with curl (from within the Home Assistant container!):
bash-5.0# curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: text/json" -d "green=true" http://192.168.178.172/state.json
returns a reply body
{"state":"off","logicstate":"false","led":"true","blinking":"0"}
Anyone has any idea what has changed to cause this? I checked the code for RESTful switch / sensor on Github - nothing seems to have changed there.
Thanks!