I have a problem with an automation that take the value from an ESPHome rotary encoder, and sends it to a hue lamp as % brightness.
This same thing happens if I use HA automation - e.g. below or a node-red flow.
- id: '1554409646088'
alias: Office Dimmer
trigger:
- entity_id: sensor.dimmer_rotary_encoder
platform: state
condition: []
action:
service: light.turn_on
entity_id: light.hue_color_lamp
data_template:
brightness_pct: '{{states.sensor.dimmer_rotary_encoder | int}}'
The error I see in HA logs is as follows:
Sat Apr 06 2019 15:55:53 GMT+0100 (British Summer Time)
Error while executing automation automation.office_dimmer. Unknown error for call_service at pos 1:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/automation/__init__.py", line 380, in action
await script_obj.async_run(variables, context)
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 131, in async_run
await self._handle_action(action, variables, context)
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 210, in _handle_action
action, variables, context)
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 299, in _async_call_service
context=context
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 88, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1138, in async_call
self._execute_service(handler, service_call))
File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1160, in _execute_service
await handler.func(service_call)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/light/__init__.py", line 285, in async_handle_light_on_service
await light.async_turn_on(**pars)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/hue/light.py", line 389, in async_turn_on
await self.light.set_state(**command)
File "/usr/local/lib/python3.7/site-packages/aiohue/lights.py", line 117, in set_state
json=data)
File "/usr/local/lib/python3.7/site-packages/aiohue/bridge.py", line 64, in request
_raise_on_error(data)
File "/usr/local/lib/python3.7/site-packages/aiohue/bridge.py", line 78, in _raise_on_error
raise_error(data['error'])
File "/usr/local/lib/python3.7/site-packages/aiohue/errors.py", line 39, in raise_error
raise cls("{}: {}".format(type, error['description']))
aiohue.errors.AiohueException: 901: Internal error, 404
Any ideas what is causing this?
I speculate I might be pushing too many API calls to hue bridge since the rotary encoder value is changing quickly, but this used to work fine before (see here - I have been using this same automation on and off for a few years).
Seems the exception is thrown by the python API rather than being surfaced from the hue bridge though.