I’m trying to send an IR packet to a Broadlink RM Mini3 in an appdaemon app.
Worth mentioning that I succeeded to do it via the Services tab in the Developer Tools. So, this works perfectly:
However, inside an appdaemon app using:
self.call_service("broadlink/send", data={"host": "192.168.88.146", "packet": "JgCwAFceDh4ODw4PDx0dDw0QDhANEA0QDg4QDg8PDRAPDg4QDg8dDw0eDw8OAAq2Vh4OHg0QDg8OHh0PDg4PEA4PDRANEA4PDhAODw8ODhAODh0QDR8NEA0ACrdWHg8dDg8OEA0eHQ8PDg4QDRANEA4PDhANEA0QDhAODw4PHQ8OHg0QDQAKtlYfDh4NEA0QDh4cEA0QDg8OEA0QDRANEA4PDhAODw8ODhAdDg8dDhAOAA0FAAAAAAAAAAA=="})
this error arises:
2019-10-30 00:15:54.899006 WARNING AppDaemon: ------------------------------------------------------------
2019-10-30 00:15:54.899375 WARNING AppDaemon: Unexpected error in worker for App control_canales:
2019-10-30 00:15:54.899855 WARNING AppDaemon: Worker Ags: {'name': 'control_canales', 'id': UUID('81f7ec31-7881-4dea-90b1-63130c28c8d8'), 'type': 'attr', 'function': <bound method Canales.toogle_tv of <canales.Canales object at 0x7f6770331e10>>, 'attribute': 'state', 'entity': 'input_boolean.power_telesalon', 'new_state': 'on', 'old_state': 'off', 'kwargs': {'handle': UUID('78b3a082-c054-4532-903e-7a42cc8055f6')}}
2019-10-30 00:15:54.900071 WARNING AppDaemon: ------------------------------------------------------------
2019-10-30 00:15:54.901224 WARNING AppDaemon: Traceback (most recent call last):
File "/home/homeassistant/appdaemon/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 595, in worker
self.sanitize_state_kwargs(app, args["kwargs"]))
File "/home/homeassistant/appdaemon/apps/canales.py", line 21, in toogle_tv
self.call_service("broadlink/send", data={"host": "192.168.88.146", "packet": "JgCwAFceDh4ODw4PDx0dDw0QDhANEA0QDg4QDg8PDRAPDg4QDg8dDw0eDw8OAAq2Vh4OHg0QDg8OHh0PDg4PEA4PDRANEA4PDhAODw8ODhAODh0QDR8NEA0ACrdWHg8dDg8OEA0eHQ8PDg4QDRANEA4PDhANEA0QDhAODw4PHQ8OHg0QDQAKtlYfDh4NEA0QDh4cEA0QDg8OEA0QDRANEA4PDhAODw8ODhAdDg8dDhAOAA0FAAAAAAAAAAA=="})
File "/home/homeassistant/appdaemon/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
File "/home/homeassistant/appdaemon/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 522, in call_service
r.raise_for_status()
File "/home/homeassistant/appdaemon/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.88.8:8123/api/services/broadlink/send
2019-10-30 00:15:54.901565 WARNING AppDaemon: ------------------------------------------------------------
I’ve tried many different ways to put the host and packet arguments but all of them result in an “invalid syntax” error. For instance:
2019-10-30 22:33:31.642974 WARNING AppDaemon: ------------------------------------------------------------
2019-10-30 22:33:31.643405 WARNING AppDaemon: Unexpected error loading module: /home/homeassistant/appdaemon/apps/canales.py:
2019-10-30 22:33:31.643643 WARNING AppDaemon: ------------------------------------------------------------
2019-10-30 22:33:31.644459 WARNING AppDaemon: Traceback (most recent call last):
File "/home/homeassistant/appdaemon/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
self.read_app(mod["name"], mod["reload"])
File "/home/homeassistant/appdaemon/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1795, in read_app
importlib.reload(self.modules[module_name])
File "/usr/lib/python3.6/importlib/__init__.py", line 166, in reload
_bootstrap._exec(spec, module)
File "<frozen importlib._bootstrap>", line 618, in _exec
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/homeassistant/appdaemon/apps/canales.py", line 21
self.call_service("broadlink/send", host= "192.168.88.146", packet= "JgCwAFceDh4ODw4PDx0dDw0QDhANEA0QDg4QDg8PDRAPDg4QDg8dDw0eDw8OAAq2Vh4OHg0QDg8OHh0PDg4PEA4PDRANEA4PDhAODw8ODhAODh0QDR8NEA0ACrdWHg8dDg8OEA0eHQ8PDg4QDRANEA4PDhANEA0QDhAODw4PHQ8OHg0QDQAKtlYfDh4NEA0QDh4cEA0QDg8OEA0QDRANEA4PDhAODw8ODhAdDg8dDhAOAA0FAAAAAAAAAAA=="}) # Power button
^
SyntaxError: invalid syntax
2019-10-30 22:33:31.644880 WARNING AppDaemon: ------------------------------------------------------------
Any hint would be appreciated. Thanks!
PS: This is my system health:
arch x86_64
dev false
docker false
hassio false
os_name Linux
python_version 3.6.8
timezone Europe/Madrid
version 0.99.2
virtualenv true