Having a hard time understanding the RESTful Command service.
I’m trying to automate my TV via the DIAL API. Posting the following through a restful client Im able to control my TV, but I can’t get my head around how to get it to work using the restful service.
Posting the following as raw data will increase the volume (where the key code is the variable) <?xml version="1.0" ?><remote><key code="1017"/></remote>
Have tried the following in the config but it just throws errors:
Sun Jul 15 2018 14:43:59 GMT+0200 (CEST)
Error executing service <ServiceCall rest_command.tv_remote>
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/rest_command.py", line 105, in async_service_handler
headers=headers
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 387, in _request
await resp.start(conn)
File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 748, in start
message, payload = await self._protocol.read()
File "/usr/local/lib/python3.6/site-packages/aiohttp/streams.py", line 533, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/app/homeassistant/core.py", line 1007, in _event_to_service_call
await service_handler.func(service_call)
File "/usr/src/app/homeassistant/components/rest_command.py", line 118, in async_service_handler
_LOGGER.error("Client error %s.", request.url)
UnboundLocalError: local variable 'request' referenced before assignment
I tried Advanced Rest Client add-on for Chrome with the following:
Default headers
Body content type: application/XML
No need for authentication.
I have a hard time understanding the documentation for the service so I have no idea what the content type parameter should be?
At least I think that should work. If not, then might need to use an input_text as a “variable” to pass the code. Let me know if the above works for you or not.