-
Notifications
You must be signed in to change notification settings - Fork 24
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
Klf200 class with new frames, reorganisation of files #56
Conversation
pyvlx/frames/frame_facory_default.py pyvlx/frames/frame_get_local_time.py pyvlx/frames/frame_get_network_setup.py pyvlx/frames/frame_leave_learn_state.py pyvlx/frames/frame_password_change.py
Add Api Functionality for KLF200 Commands
eg. pyvlx.klf200.reboot reboots the gateway update pyvlx functions as wrapper for klf200 object
uh, this is a large one... :) Thank you very much! The PR is marked as draft - tell me when the PR is in a state when it is worth having a deeper look. Best |
Sorry - smaller chuncks in PR next time Greets |
@@ -39,7 +39,9 @@ async def run(self, wait_for_completion=True): | |||
|
|||
def __str__(self): | |||
"""Return object as readable string.""" | |||
return '<Scene name="{0}" ' 'id="{1}" />'.format(self.name, self.scene_id) | |||
return '<{} name="{}" id="{}"/>'.format( |
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.
What about using fancy python format strings here? (I would also be fine if we do this in a separate step)
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.
hope, i get you right.
it was inconsistent with single or double quotes (see eg. pyvlx/api/frames/frame_set_node_name.py)
i added type(self).name is because i am lazy and dont want to type too much
seperate steps is maybe the main thing in this pr. too many things together
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.
Yes, fully agree. It is a good improvement. I just thought of using:
return f'<{type(self).__name__} name="{self.name}" id="{self.scene_id}"/>'
But im not sure if this is an improvement...
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.
nah. this is a mess. i should be even more strict
return '<{0} name="{1}" id="{2}"/>'.format( ...
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.
Ugh, what a large PR! Thank you, all looks good to me.
I assume you tested all the changes locally (besides unit tests...)?
Another question, do you have any idea how to approach this "KLF 200 hangs" problem? |
those were easy to test with my klf200 |
#30 ? I currently use https://github.com/MiSchroe/ioBroker.klf200 which is restarted by default at 03:00 every day. maybe the same problems there? |
Yup. This seems like the same root cause. There is also a PR in Hass requesting this feature: https://github.com/home-assistant/core/pull/43198/files |
my first considerations: but: its not the same situation as restart of HA, but i can even influcence an active connection from pyvlx or iobroker klf200.0 by killing just another connection:
d) wait a bit and try openssl again -> works |
this is exactly what
says in #30 setting ssl handshake timeout and permanently retrying should do the job imho |
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.
There are a lot of changes in this one PR.
pyvlx/klf200gateway.py
Outdated
leave_learn_state = LeaveLearnState(pyvlx=self.pyvlx) | ||
await leave_learn_state.do_api_call() | ||
if not leave_learn_state.success: | ||
PYVLXLOG.warning("Unable to leave learn state") |
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.
Is there a reason why some methods raise an exception and some only log a warning? I think this can be aligned.
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.
aligned: raise pyvlx exceptions on api unsuccessful
fixed: LeaveLearnStateConfirmationStatus does not influcence Status
but arises question: should GW_ERROR_NTF be handled in any way?
Remove pyvlx.update_version
All raise exceptions now
@icommitdesnet : Just tell me when you are ready, then I do a last round of reviews... |
I think this one is ok now. |
Thank you very much! |
No description provided.