-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reboot function added #43
Conversation
As a separate function it is now also possible to initiate a reboot when HA is rebooted. |
pyvlx/pyvlx.py
Outdated
@@ -47,6 +48,16 @@ async def connect(self): | |||
await login.do_api_call() | |||
if not login.success: | |||
raise PyVLXException("Login to KLF 200 failed, check credentials") | |||
if self.connection.connection_counter & 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this logic should be handled within HASS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. At the moment it seems that this doesn't solve the problem at all. I still had a frozen KLF over the weekend even though I initiate a reboot via HASS at async def on_hass_stop(event):
. So before HASS is stopped for a reboot.
However I'm not sure whether the KLF was also rebooting when I had rebooted HASS. Last time I only could observe one reboot, but at a timing when HASS was loaded, not when HASS was shutting down. I'll have to do some more tests with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All approaches are somehow fishy ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cleaned it up, so now only the reboot function is added and the connection counter, but no automatic reboot. On my custom component I have added an automatic reboot on hass stop event
@pawlizio : The change looks good. But may I ask you to add some tests for it? Just to make sure we dont break the functionality in any future release .. Thank you very much! |
I added tests for each frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks valid :)
Sorry to write here to ask for guidance: I'd like to test rebooting the KLF on HASS restart, I didn't find how to call the service just implemented. |
@Julius2342 : Could you kindly release the version with implemented reboot functionality and update the HASS manifest? On my custom component I have modified as follows:
However to be hones, I've still lots of freezes on KLF. Sometimes KLF looses the connection without reboot on HASS.
I'm thinking about registering an event on HASS in order to initiate a reboot each time a connection has been lost (hoping that a second connection to KLF could be established). However I'm not that experienced developer and have currently no idea how to realize it. |
This pull request adds reboot functionality to pyvlx
and reboot will be performed each 2nd connection (after 1st connection, after 3rd, after 5th,...) in order to avoid that KLF200 freezes due to lost TLS sockets.
This is experimental only, not sure if this fix the SSL Handshake Issue #30 at all.