-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
Fix linky sensor login error #17110
Fix linky sensor login error #17110
Conversation
from pylinky.client import PyLinkyError | ||
from pylinky.client import LinkyClient, PyLinkyError | ||
|
||
client = LinkyClient(self._username, self._password) |
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.
You probably need to close the session after fetch_data()
.
See also pyLinky main.
finally:
client.close_session()
Adding following enhancements: * Make sure the platform loads correctly by making the first API request in setup_platform. * Close the session after each API call. * Use timeout parameter everywhere.
Make platform fail-safe
from pylinky.client import PyLinkyError | ||
from pylinky.client import LinkyClient, PyLinkyError | ||
|
||
client = LinkyClient(self._username, self._password, None, self._timeout) |
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.
line too long (81 > 79 characters)
Fix Hound CI error: line too long.
Please add to the PR description, why this change solves the issue. |
from pylinky.client import PyLinkyError | ||
from pylinky.client import LinkyClient, PyLinkyError | ||
|
||
client = LinkyClient(self._username, self._password, None, |
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.
Why do we need to create a new client on every update?
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.
First solution use one client, created in setup_platform, but it's seems to not work (Login error).
With a new client on every update, that resolve the issue.
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.
It would be good to know why.
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 with you.
My solution was a hotfix what work for me and closing error login issue, it's why i share it. In wait I've found a better solution, do you want I cancel my PR ?
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.
We shouldn't necessarily close this. Let's hear what other reviewers think. If this PR fixes the problem, that's a first 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.
I can confirm that this fixes the original issue.
I have tried to re-use the client, but the original error occurs again.
It seems that the session cannot be re-used. Then this might be an issue in the pyLinky library.
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.
After some tests, I agree with @hobbe : pyLinky library session cannot be re-used.
So, for now, we need to re-create an client at each update.
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 suggest that you open an issue for pyLinky to get it fixed.
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've open a PR on pyLinly library to improve client (Pirionfr/pyLinky#5).
Can this fix be pushed to 0.80 as this component is not working since its release in 0.79? |
@@ -75,11 +75,12 @@ def unit_of_measurement(self): | |||
@Throttle(SCAN_INTERVAL) | |||
def update(self): | |||
"""Fetch new state data for the sensor.""" | |||
from pylinky.client import PyLinkyError | |||
from pylinky.client import LinkyClient, PyLinkyError |
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.
'pylinky.client.LinkyClient' imported but unused
Now, we are using last pyLink version (0.1.8) which allow to reuse client session. |
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.
Great!
Hi ! I modified the python source file to expose the user and names, and I can guarantee they are valid. Trying to trace the execution, it seems that it fails finding the cookie iPlanetDirectoryPro. I checked with the debug options of my web browser, and locally I've got this cookie... One thing though, now, when connecting on the Enedis webpage, it doesn't bring you to your user space, but it rather do several redirections (during these redirections the cookie seems to be not accessible) and brings to you to the website welcome page (iPlanetDirectoryPro) is then available. Am I the only one with this issue ? |
Please open an issue if you suspect a bug. If you need help please use our help channels: Merged PRs should not be used for support or bug reports. Thanks! |
Description:
Fix linky sensor login error .
Related issue (if applicable): fixes #17077
Checklist:
tox
. Your PR cannot be merged unless tests pass