home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.93k stars 30.15k forks source link

Velux Core Integration Fails #114230

Open swdwi2 opened 6 months ago

swdwi2 commented 6 months ago

The problem

Although connections to the KLF200 appear OK Home Assistant returns and error for service call when selected

What version of Home Assistant Core has the issue?

System information Version core-2024.3.3 Installation Type Home Assistant Container Development false Supervisor false Docker true User root Virtual Environment false Python Version 3.12.2 Operating System Family Linux Operating System Version 5.15.0-97-generic CPU Architecture x86_64 Timezone Europe/London Configuration Directory /config Home Assistant Community Store GitHub API ok GitHub Content ok GitHub Web ok GitHub API Calls Remaining 4351 Installed Version 1.34.0 Stage running Available Repositories 1413 Downloaded Repositories 40 Home Assistant Cloud Logged In true Subscription Expiration 16 November 2024 at 00:00 Relayer Connected true Relayer Region eu-central-1 Remote Enabled true Remote Connected true Alexa Enabled true Google Enabled false Remote Server eu-central-1-8.ui.nabu.casa Certificate Status ready Instance ID 2ac5c7f194ed4b7f99ca15934de7b4cc Reach Certificate Server ok Reach Authentication Server ok Reach Home Assistant Cloud ok Dashboards Dashboards 4 Resources 22 Views 39 Mode storage Recorder Oldest Run Start Time 16 March 2024 at 11:47 Current Run Start Time 26 March 2024 at 09:58 Estimated Database Size (MiB) 1062.44 MiB Database Engine sqlite Database Version 3.44.2 Sonoff Version 3.6.0 (8dd8af9) Cloud devices online 0 / 0 Local devices online 0 / 6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Velux

Link to integration documentation on our website

No response

Diagnostics information

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:239 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 10:03:26 (1 occurrences) Last logged: 10:03:26

[139743432962496] Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/velux/cover.py", line 98, in async_close_cover await self.node.close(wait_for_completion=False) File "/usr/local/lib/python3.12/site-packages/pyvlx/opening_device.py", line 127, in close await self.set_position( File "/usr/local/lib/python3.12/site-packages/pyvlx/opening_device.py", line 92, in set_position await command.send() File "/usr/local/lib/python3.12/site-packages/pyvlx/api/command_send.py", line 74, in send raise PyVLXException("Unable to send command") pyvlx.exception.PyVLXException:

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

I was using the Velux Custom Component which occasionally showed a similar error. However the window often still opened and closed on command. Now switched to the Core integration with similar results. Shows error on home assistant dashboard but will often eventually work after multiple presses. Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/velux/cover.py", line 98, in async_close_cover await self.node.close(wait_for_completion=False) File "/usr/local/lib/python3.12/site-packages/pyvlx/opening_device.py", line 127, in close await self.set_position( File "/usr/local/lib/python3.12/site-packages/pyvlx/opening_device.py", line 92, in set_position await command.send() File "/usr/local/lib/python3.12/site-packages/pyvlx/api/command_send.py", line 74, in send raise PyVLXException("Unable to send command") pyvlx.exception.PyVLXException:

home-assistant[bot] commented 6 months ago

Hey there @julius2342, @deermaximum, mind taking a look at this issue as it has been labeled with an integration (velux) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `velux` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign velux` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


velux documentation velux source (message by IssueLinks)

swdwi2 commented 6 months ago

Appreciate some feedback on this issue

pflugj commented 5 months ago

Same issue here :-( Velux Custom Component was working fine. switched to the Core integration and the problem started

Logger: homeassistant.config_entries Source: config_entries.py:551 First occurred: 17:11:09 (1 occurrences) Last logged: 17:11:09

Error setting up entry 192.168.1.11 for velux Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/velux/init.py", line 52, in async_setup_entry await module.async_start() File "/usr/src/homeassistant/homeassistant/components/velux/init.py", line 102, in async_start await self.pyvlx.load_scenes() File "/usr/local/lib/python3.12/site-packages/pyvlx/pyvlx.py", line 106, in load_scenes await self.scenes.load() File "/usr/local/lib/python3.12/site-packages/pyvlx/scenes.py", line 56, in load await get_scene_list.do_api_call() File "/usr/local/lib/python3.12/site-packages/pyvlx/api/api_event.py", line 29, in do_api_call await self.pyvlx.check_connected() File "/usr/local/lib/python3.12/site-packages/pyvlx/pyvlx.py", line 83, in checkconnected await self.connect() File "/usr/local/lib/python3.12/site-packages/pyvlx/pyvlx.py", line 58, in connect await self.connection.connect() File "/usr/local/lib/python3.12/site-packages/pyvlx/connection.py", line 103, in connect self.transport, = await self.loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1120, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1102, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1005, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.11', 51200)

onvi80 commented 5 months ago

Same here. Works fine with Custom Component. With Velux Integration the entities are most time unknown. After a few reboots (HA, KLF200) the entities are back again and usable but the „Velux“ integation shows the correct IP with „no devices or entities“.

IMG_1391

pergolafabio commented 4 months ago

Is this one under investigation?

swdwi2 commented 4 months ago

Is this one under investigation?

I've given up on this for the moment. No action from the code owner. If you are using the KLF200 then you can do what I did. The KLF200 accepts switch inputs which you can connect to actions. With internal configuration of the KLF you can make it do anything the remote does in response to a switch input. I used a Sonoff 4CH pro to provide 4 switch inputs open/close for my window and Blind to the KLF. Not as neat as the component but works reliably.

taminelli commented 4 months ago

@Julius2342 is an update planned?

skon2612 commented 4 months ago

I think i have the same issue:

Logger: homeassistant.components.velux
Quelle: components/velux/__init__.py:52
Integration: Velux ([Dokumentation](https://www.home-assistant.io/integrations/velux), [Probleme](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+velux%22))
Erstmals aufgetreten: 20:34:18 (1 Vorkommnisse)
Zuletzt protokolliert: 20:34:18

Can't connect to velux interface: <PyVLXException description="Unable to retrieve version" />
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 52, in async_setup_entry
    await module.async_start()
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 102, in async_start
    await self.pyvlx.load_scenes()
  File "/usr/local/lib/python3.12/site-packages/pyvlx/pyvlx.py", line 106, in load_scenes
    await self.scenes.load()
  File "/usr/local/lib/python3.12/site-packages/pyvlx/scenes.py", line 56, in load
    await get_scene_list.do_api_call()
  File "/usr/local/lib/python3.12/site-packages/pyvlx/api/api_event.py", line 29, in do_api_call
    await self.pyvlx.check_connected()
  File "/usr/local/lib/python3.12/site-packages/pyvlx/pyvlx.py", line 83, in check_connected
    await self.connect()
  File "/usr/local/lib/python3.12/site-packages/pyvlx/pyvlx.py", line 61, in connect
    await self.klf200.get_version()
  File "/usr/local/lib/python3.12/site-packages/pyvlx/klf200gateway.py", line 71, in get_version
    raise PyVLXException("Unable to retrieve version")
pyvlx.exception.PyVLXException: <PyVLXException description="Unable to retrieve version" />
Julius2342 commented 4 months ago

Can you provide a diff between the main velux component and the custom component you are using?

From what I see, the KLF200 is a pretty shitty piece of hardware, which under unclear conditions just stops working. When anything on the networkside fails, pyvlx raises an exception. I dont know how to handle this differently.

pergolafabio commented 4 months ago

Hey @Julius2342 , i'm using this one:

https://github.com/pawlizio/my_velux

its being maintained by @pawlizio , he is also helping you on the pyvlx repo

pawlizio commented 4 months ago

Can someone who can reproduce this issue activate pyvlx debugging and paste the corresponding logs.

skon2612 commented 4 months ago

Hey @Julius2342 , i'm using this one:

https://github.com/pawlizio/my_velux

its being maintained by @pawlizio , he is also helping you on the pyvlx repo

could you please explain what the positiv things are when i am using this custom integration and not the official? Is the issue solved with the custom integration?

pergolafabio commented 4 months ago

it has some improvements indeed, and i also use the rainsensor

taminelli commented 3 months ago

integration?

This integration do not work withe the newest ha version :(

frr032 commented 2 months ago

I'm not sure if there are/were multiple Velux custom components. However, the one I WAS using (see config dir pic below) seemed to be more stable than this core integration as I am having similar issues as in this post. It also had several more entities that I miss in the core integration. e.g. velocity, connection counter, heartbeat, etc. Can these be added back in the core? Also, my Velux covers/skylights have a rain sensor. Can the Rain sensor entity be added to the core integration if available? That would be great! Thanks

image