Closed wltng closed 2 years ago
I've modified pyvlx a bit, see here for details. Just restart your HA for testing. Please let me know if that fixes your issue.
Thanks for your response! I restarted HA (how can I tell if I'm using the correct pyvlx version?). I also updated to version 2.4
After a short power down it is ok. It reconnects and keeps sending the heartbeat A longer poweroff results in the same as before. No heartbeat anymore.
I attached my logfile, with some comments at the moments of connecting. I hope this helps. pyvlx.log
Actually if you use 2.4 it should automatically use my pyvlx@master, as long as official pyvlx version is < 0.2.21, see the manifest: https://github.com/pawlizio/my_velux/blob/871129d3739716c66c38a6997f5086682d6fc02d/custom_components/velux/manifest.json#L6
With regards to your logs the strange is, that your HA send several FrameGetStateRequests without any feedback and this does not result in an error. I've expected that pyvlx rise the exception PyVLXException("Unable to send get state."), but it seems there was another issue on getstate.py, which I hope I've solved now with this modification. Please can you restart your HA instance and retry.
Thanks for taking the time to look into this. I still see the same behavior.
2022-06-27 19:27:23 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2022-06-27 19:28:33 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2022-06-27 19:29:43 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
Every ~70 seconds a get state command without response or exceptions.
If I try to call the reboot service I do get the following exception:
2022-06-27 19:30:40 WARNING (MainThread) [pyvlx] KLF 200 reboot initiated
2022-06-27 19:30:40 DEBUG (MainThread) [pyvlx] SEND: <FrameGatewayRebootRequest/>
2022-06-27 19:30:50 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall velux.reboot_gateway (c:01G6K3E9839A1XK75TF5XKSS8B)>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1722, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/config/custom_components/velux/__init__.py", line 52, in async_reboot_gateway
await gateway.reboot_gateway()
File "/usr/local/lib/python3.9/site-packages/pyvlx/pyvlx.py", line 60, in reboot_gateway
await self.klf200.reboot()
File "/usr/local/lib/python3.9/site-packages/pyvlx/klf200gateway.py", line 100, in reboot
raise PyVLXException("Unable to reboot gateway.")
pyvlx.exception.PyVLXException: <PyVLXException description="Unable to reboot gateway." />
The only thing I've done is turn off the power to the gateway.
I've added a debug log on pyvlx loading, in order to check that you load the correct pyvlx. So can you check if this log is visible:
Loading https://github.com/pawlizio/pyvlx.git@master
I don't see this log appearing. I also reinstalled the custom component using HACS, but the log doesn't show. Any way to force it? Maybe if I put a higher version in the manifest.json?
I didn't get it working either, not sure why. Pretty sure I did it the same way with other topics, but don't work now.
@wltng Can you restart your HA and test again. I think I found a way to force HA to install the correct GitHub pyvlx version. In the log you should see this after restart:
DEBUG (MainThread) [pyvlx] Loading https://github.com/pawlizio/pyvlx.git@master v0.1.22
It seems to have been installed:
2022-07-03 08:09:38 DEBUG (MainThread) [pyvlx] Loading https://github.com/pawlizio/pyvlx.git@master v0.1.25
However, I get this error message now:
2022-07-03 08:09:54 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 10.0.1.110 for velux Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 339, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/velux/__init__.py", line 35, in async_setup_entry await gateway.connect() File "/usr/local/lib/python3.9/site-packages/pyvlx/pyvlx.py", line 47, in connect await house_status_monitor_disable(pyvlx=self) File "/usr/local/lib/python3.9/site-packages/pyvlx/api/house_status_monitor.py", line 65, in house_status_monitor_disable raise PyVLXException("Unable disable house status monitor.") pyvlx.exception.PyVLXException: <PyVLXException description="Unable disable house status monitor." />
The integration isn't loading anymore atm
Does it work after a KLF200 power down/up and another HA reboot? I had this too on the first trial... not sure why.
I modified slightly the House Status Monitor (HSM), which seems to be the problem with an SSL Handshake issue. Unfortunately KLF200 provides no support to ask the device whether HSM is enabled or not. So now I included during connection built-up routine, first to disable HSM just in case in was maybe on from a previous connection. Afterwards the HSM is enabled again.
After a reboot and restart it connects again. The behavior is a little different, but the heartbeat is not activated after reconnecting.
SEND: <FrameGetStateRequest/>
2022-07-03 10:38:57 DEBUG (MainThread) [pyvlx] REC: <FrameGetStateConfirmation gateway_state="GatewayState.GATEWAY_MODE_WITH_ACTUATORS" gateway_sub_state="GatewaySubState.IDLE"/>
2022-07-03 10:39:57 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2022-07-03 11:48:33 DEBUG (MainThread) [pyvlx] Connecting to KLF 200 on <pyvlx.pyvlx.PyVLX object at 0x7f83d2901f40>
2022-07-03 11:48:38 DEBUG (MainThread) [pyvlx] Amount of connections since last HA start: 2
2022-07-03 11:48:38 DEBUG (MainThread) [pyvlx] SEND: <FramePasswordEnterRequest
The frame get state request is only sent once now after power down, but I don't get an exception. Power down at around 10:39 After power up the first command is delayed ~5 seconds because it has to reconnect. After 15 minutes it needs to reconnect again bacause of the missing heartbeat
Can you send the log incl. 2 minutes after reconnection.
I'm trying to restart HA, to make a clean log, but i cannot restart because of the following error:
The system cannot restart because the configuration is not valid: Component error: velux - cannot import name 'house_status_monitor_disable' from 'pyvlx.api.house_status_monitor' (/usr/local/lib/python3.9/site-packages/pyvlx/api/house_status_monitor.py)
edit: After removing everything related to the velux integration and reinstalling I was able to get it back to work.
I attached a new log file Power down just before 16:58:58 pyvlx.log
Ohh damn... You for one of the non-working pyvlx. Please restart the HA host
I made some further modification on my custom. Now it's possible from the UI to control the Heartbeat, the House Status Monitor and restarting the KLF:
Just update to the latest version
I updated to version 2.6 From the looks of it, I will at least be able to automate the heartbeat and house monitor.
Thanks for your efforts.
I will report back if I encounter problems.
Just wanted to say thanks for all your work on this. It should be part of core Home Assistant!
I noticed that the heartbeat is no longer sent after a power cycle of the KLF without restarting HA My KLF is turned of every night automatically, the next morning it reconnects when it is available again, but the heartbeat is not being sent anymore. Connection counter is now 2. When I use it the first time, the socket is probably already closed, it reconnects and connection counter is now 3. This happens every time it has not been used for more than 15 minutes, connection counter keeps going up The first command is noticeably delayed because of reconnecting. Is there a way to make the heartbeat sent after every reconnection?
Thanks!