-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Add coordinator to evohome and prune async_update code #119432
Conversation
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 is the wrong way to go. Put a helper in init instead if you need to share this between config flow and legacy setup.
Putting this in the broker moves setup logic into class that could just have easily been injected. Its generally easier to handle cleanup if you inject things and avoid construction of sub objects in init
Should have been enough |
I don't need to rerun script/setup? (I'm not at home to check) |
CI should be fixed with #120080 |
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.
Some observations that should be handled
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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 do think there is room for improvement, but at this point, it's acceptable, so let's merge this just to improve it a bit and continue iterating from there
The background is that my library is a 'faithful' async port (requests to aiohttp) of a much older library not written by me. By faithful, I mean I chose to keep the original namespace, to help others switch over, and that is the root cause of many of these challenges (e.g. Only recently have I accepted the wisdom of deviating from the original design, and that will allow me to address these 'situations'. Presently, I am stuck down a rabbit hole making changes to evohome-async, including adding an In the meantime, I would love to get this PR merged. |
Proposed change
This PR makes changes that will prepare this integration for config flow:
DataUpdateCoordinator
username
,password
) from other options (i.e.location_idx
) to better match the config flow patternasync_update()
code that was out-of-placeI have some tests for this code, but will add them in a subsequent PR.
It does not include config flow.
Later PRs will make further changes (e.g. adding tests), until the final PR, which will add config flow. The objective is for a sequence of small PRs, rather than one large PR.
There are no breaking changes and no new functionality.
Type of change
Additional information
async_setup()
toEvoSession
, so that that code is now accessible to (say) config flowasync_setup()
toEvoBroker
, so that that code is now accessible to (say) options flowThis PR is a pre-requisite for #119008, which has become otherwise untenable
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: