Strange problem I just face; for one of my ceiling lights (IKEA G10 bulb) I want to add separate switch (also IKEA) to turn it on/off and make it dimmable separate from all scenes I use in living room. Purpose is to use it as separate reading light. I tried to use prooven @KennethLavrsen solution for this, that works perfectly fine for many other lights. Here is the code I use (exact copy paste from other automation, with only entities id changed):
- alias: 'Increase reading light brightness'
initial_state: true
trigger:
platform: event
event_type: deconz_event
event_data:
id: reading_light_on_off_switch
event: 1001
action:
- service: deconz.configure
data:
entity: light.ceiling_11
field: "/action"
data: {"bri_inc":254, "transitiontime":35}
- alias: 'Decrease reading light brightness'
initial_state: true
trigger:
platform: event
event_type: deconz_event
event_data:
id: reading_light_on_off_switch
event: 2001
action:
- service: deconz.configure
data:
entity: light.ceiling_11
field: "/action"
data: {"bri_inc":-254, "transitiontime":35}
- alias: 'Stop brightness changes reading light'
initial_state: true
trigger:
- platform: event
event_type: deconz_event
event_data:
id: reading_light_on_off_switch
event: 1003
- platform: event
event_type: deconz_event
event_data:
id: reading_light_on_off_switch
event: 2003
action:
- service: deconz.configure
data:
entity: light.ceiling_11
field: "/action"
data: {"bri_inc":0}
Unfortunatelly it does not work. In log file I can see some errors associated with these automation (here is sample from trying to increase the brightness):
2023-01-14 16:26:47.669 ERROR (MainThread) [homeassistant.components.automation.increase_reading_light_brightness] Increase reading light brightness: Error executing script. Unexpected error for call_service at pos 1: 4 /lights/67/action method, PUT, not available for resource, /lights/67/action
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 89, in async_call_deconz_service
await async_configure_service(gateway, service_data)
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 140, in async_configure_service
await gateway.api.request("put", field, json=data)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 167, in request
response: dict[str, Any] = await self._request(
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 194, in _request
_raise_on_error(response)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 225, in _raise_on_error
raise_error(data["error"])
File "/usr/local/lib/python3.10/site-packages/pydeconz/errors.py", line 73, in raise_error
raise cls(
pydeconz.errors.RequestError: 4 /lights/67/action method, PUT, not available for resource, /lights/67/action
2023-01-14 16:26:47.670 ERROR (MainThread) [homeassistant.components.automation.increase_reading_light_brightness] While executing automation automation.increase_reading_light_brightness
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 89, in async_call_deconz_service
await async_configure_service(gateway, service_data)
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 140, in async_configure_service
await gateway.api.request("put", field, json=data)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 167, in request
response: dict[str, Any] = await self._request(
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 194, in _request
_raise_on_error(response)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 225, in _raise_on_error
raise_error(data["error"])
File "/usr/local/lib/python3.10/site-packages/pydeconz/errors.py", line 73, in raise_error
raise cls(
pydeconz.errors.RequestError: 4 /lights/67/action method, PUT, not available for resource, /lights/67/action
2023-01-14 16:26:49.633 ERROR (MainThread) [homeassistant.components.automation.stop_brightness_reading_light] Stop brightness reading light: Error executing script. Unexpected error for call_service at pos 1: 4 /lights/67/action method, PUT, not available for resource, /lights/67/action
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 89, in async_call_deconz_service
await async_configure_service(gateway, service_data)
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 140, in async_configure_service
await gateway.api.request("put", field, json=data)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 167, in request
response: dict[str, Any] = await self._request(
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 194, in _request
_raise_on_error(response)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 225, in _raise_on_error
raise_error(data["error"])
File "/usr/local/lib/python3.10/site-packages/pydeconz/errors.py", line 73, in raise_error
raise cls(
pydeconz.errors.RequestError: 4 /lights/67/action method, PUT, not available for resource, /lights/67/action
2023-01-14 16:26:49.634 ERROR (MainThread) [homeassistant.components.automation.stop_brightness_reading_light] While executing automation automation.stop_brightness_reading_light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 89, in async_call_deconz_service
await async_configure_service(gateway, service_data)
File "/usr/src/homeassistant/homeassistant/components/deconz/services.py", line 140, in async_configure_service
await gateway.api.request("put", field, json=data)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 167, in request
response: dict[str, Any] = await self._request(
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 194, in _request
_raise_on_error(response)
File "/usr/local/lib/python3.10/site-packages/pydeconz/gateway.py", line 225, in _raise_on_error
raise_error(data["error"])
File "/usr/local/lib/python3.10/site-packages/pydeconz/errors.py", line 73, in raise_error
raise cls(
pydeconz.errors.RequestError: 4 /lights/67/action method, PUT, not available for resource, /lights/67/action
What is wrong here? Any idea?