I’m trying to configure a REST Switch but for some anoying reason it seems to be sending a GET request even with the method set to PUT then I’m receiving this error:
2023-07-13 11:18:22.293 DEBUG (MainThread) [httpcore.http11] receive_response_body.started request=<Request [b'GET']>
2023-07-13 11:18:22.294 DEBUG (MainThread) [httpcore.http11] receive_response_body.complete
2023-07-13 11:18:22.295 DEBUG (MainThread) [httpcore.http11] response_closed.started
2023-07-13 11:18:22.296 DEBUG (MainThread) [httpcore.http11] response_closed.complete
2023-07-13 11:18:22.299 ERROR (MainThread) [homeassistant.components.rest.switch] Got non-ok response from resource: 405
The configuration is:
switch:
- platform: rest
name: 'iHostTeste'
resource: 'http://192.168.0.9/open-api/v1/rest/devices/87h43h2889'
method: 'PUT'
body_on: '{ "state": { "power": { "powerState": "on" } } }'
body_off: '{ "state": { "power": { "powerState": "off" } } }'
headers:
Content-Type: application/json
Authorization: 'Bearer h43jh34j-sssa-321312-dds-123bbddd4322'
verify_ssl: false
What could be happening?