core: Velux integration with KLF 200 error when activating scenes
The problem
I have been using Velux integration with my KLF 200 without any problems for the last couple of months. I have defined scenes for the 4 Velux covers on my south roof, one for the cover open position, one for the close position, and several scenes for different opening positions of the windows, which are used in automations. A couple of days ago I updated to the latest version of Home Assistant Core. I am unfortunately not sure which version I was using before but I must have skipped a few. I might have been at 2023.5 or 2023.6 (is there any way to check my previously installed version?) . Shortly after this upgrade, I discovered that my scenes were not working anymore. Most of the time, only one or two of the covers or windows are reacting, and only when activating the scene a second or third time the remaining covers or windows adapt their position. There is an error message in the core log related to this problem.
What version of Home Assistant Core has the issue?
core-2023.8.1
What was the last working version of Home Assistant Core?
2023.7.3
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Velux integration
Link to integration documentation on our website
https://www.home-assistant.io/integrations/velux/
Diagnostics information
No response
Example YAML snippet
Example of one scene:
- id: '1669837030558'
name: Velux Sud Lueden zou
entities:
cover.tv_room_r:
current_position: 0
device_class: shutter
friendly_name: Tv room r
supported_features: 15
state: closed
cover.tv_room_l:
current_position: 0
device_class: shutter
friendly_name: Tv room L
supported_features: 15
state: closed
cover.spillzemmer_l:
current_position: 0
device_class: shutter
friendly_name: Spillzemmer L
supported_features: 15
state: closed
cover.spillzemmer_r:
current_position: 0
device_class: shutter
friendly_name: Spillzemmer r
supported_features: 15
state: closed
icon: mdi:roller-shade-closed
metadata:
cover.tv_room_r:
entity_only: true
cover.tv_room_l:
entity_only: true
cover.spillzemmer_l:
entity_only: true
cover.spillzemmer_r:
entity_only: true
Anything in the logs that might be useful for us?
2023-08-10 13:18:32.504 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547691744192] <PyVLXException description="Unable to send command" />
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/scene/__init__.py", line 114, in _async_activate
await self.async_activate(**kwargs)
File "/usr/src/homeassistant/homeassistant/components/homeassistant/scene.py", line 334, in async_activate
await async_reproduce_state(
File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 67, in async_reproduce_state
await asyncio.gather(
File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 61, in worker
await platform.async_reproduce_states(
File "/usr/src/homeassistant/homeassistant/components/cover/reproduce_state.py", line 125, in async_reproduce_states
await asyncio.gather(
File "/usr/src/homeassistant/homeassistant/components/cover/reproduce_state.py", line 86, in _async_reproduce_state
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/velux/cover.py", line 96, in async_close_cover
await self.node.close(wait_for_completion=False)
File "/usr/local/lib/python3.11/site-packages/pyvlx/opening_device.py", line 73, in close
await self.set_position(
File "/usr/local/lib/python3.11/site-packages/pyvlx/opening_device.py", line 49, in set_position
raise PyVLXException("Unable to send command")
pyvlx.exception.PyVLXException: <PyVLXException description="Unable to send command" />
Additional information
Action: activating a scene opening/closing 4 Velux shades/windows Expected behaviour: the 4 Velux shades/windows open/close at the same time Observed behaviour: only 1 or 2 Velux shades/windows open/close. A subsequent activation of the same scene opens/closes one additional shades/window. The remaining shade/window is then opened/closed with a third activation of the scene.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 3
- Comments: 25 (5 by maintainers)
I think this topic is solved, this issue was caused by a command burst which was not acknowleged by KF200. There was a change in pyvlx PR #353 to add a semaphore to the API interface which ensures that new commands are only send to KLF200 once the last command was acknowledged. It is part of latest version pyvlx 0.2.21 and is implemented to HA since version 2024.1.
[104 commits ahead], [13 commits behind] Julius2342:master.
Do you think we have the chance to bring both branches together?