Add config flow to linky#26076
Conversation
|
I actually get the same issue to make iCloud a config flow. The integration is added to HA, then, when adding all the platforms, the device_tracker calculate the interval with the current zone and other zone distances, which uses |
167e1be to
2c95491
Compare
MartinHjelmare
left a comment
There was a problem hiding this comment.
Blocking I/O in coroutines, in the event loop, will block the whole home assistant app.
2c95491 to
94a602b
Compare
|
Devices will show for the config entry if we implement https://developers.home-assistant.io/docs/en/device_registry_index.html |
b2a1f9f to
28c2b60
Compare
|
Just run black from the project root and commit the changes: |
|
Response to : #26076 (comment)
I get a "command not found error" on both. Nothing helped in Set up Development Environment and Testing your code of the developer documentation. |
|
Install black. |
|
Yep, naturally ... found it odd to be a beta |
|
pyLinky 0.4.0 just released with my PR into it, that was fast ! https://github.com/Pirionfr/pyLinky/releases/tag/v0.4.0 |
20e4f46 to
403f6fa
Compare
|
I've fixed all reviews, so what's next ? Clicking on "Ready for review" button in order to be merged or open a new PR ? For me, it misses 2 PRs : add |
|
Don't open a new PR. Just click ready for review. |
|
Tested with :
Component documentation needs to be updated |
|
Add pylinky to the |
423b515 to
72e7323
Compare
|
Working on tests ... |
72e7323 to
e1b04b5
Compare
|
Can be merged when build passes. |
e1b04b5 to
01030d8
Compare
01030d8 to
7649dbb
Compare
|
Please don't squash commits after review has started to make it easier for readers to track changes. |
|
Have you rebuilt the tox environment, |
|
There's too little information in that log excerpt for me to say anything about. |
|
Ups, wrong image, updated #26076 (comment) |
|
Doesn't help, sorry. You can check the tox file logs and see if they say anything more. |
|
Good! |






Breaking Change:
Linky platform moved to integration.
configuration.yamlbefore :After :
Documentation updated : home-assistant/home-assistant.io#10284
Description:
Hi !
Just adding Linky a config flow, but I need some help for 3 things.
I am still learning Python with you guys, while coding for HA ... everyone is pleased to make a review, go for it ! (with cool links if it's something tricky, that would be nice 👍)
I made
_LOGGER.errorto see it better, screenshots will illustrate 😉 with the actual code.1 : Make the component actually retrieving the data without stop HA boot
I mean, it's the same working retrieve data code, but the async and timeout part makes it not working I think.
So I got a
RuntimeError: cannot be called from within the event loopcaused byrun_callback_threadsafecall in a async method, then the sensors aren't created.Actually HA is booting because the sensors try to be added after HA starts with a listener and
async_startcallback, but without it's not, and no logs are coming.See the logs, at HA starts (the only way the retrieve the data for now)

This first point should be though with point 2 in mind ⬇️
2 : Add the Linky sensors directly after adding the integration by the user in the config flow (not only at boot)
I know that it should be added in
async_setup_entrybut if I do so, it is gonna block HA start and Linky's data are never gonna be retrieved. That's why there is anasync_start.So I get those logs right after adding my integration :

But no sensors.
3 : Here it's more a question but it will permits much less duplicated code
Can/Should I display "computed" errors to the user ? (one's that are not in the
strings.jsonfile)I'am telling that because the
LinkyClientcan raise multiple functional errors, but they got all the same typePyLinkyError.PyLinkyErroris raised for (quoting the pylinky lib) :raise PyLinkyError("Can not submit login form")raise PyLinkyError("Login error: Please check your username/password.")raise PyLinkyError("Could not access enedis.fr: " + str(e))raise PyLinkyError("No data")raise PyLinkyError("Site in maintenance")raise PyLinkyError("Impossible to decode response: " + str(e) + "\nResponse was: " + str(raw_res.text))raise PyLinkyError("Enedis.fr answered with an error: " + str(json_output))So how should I tell the user he has a wrong password ? or if the website is in maintenance and retry later ?
I come up this 3 ideas :
@MartinHjelmare, if you have some time I will appreciate.
Thanks a lot !
PS : config flow inspired with AdGuard Home (Config flow file, by @frenck) and Cert Expiry (still in PR #25624 by @cereal2nd) code.
Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>
Not yet