-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Vesync unload error when not all platforms used #134166
Conversation
Hey there @markperdue, @webdjoe, @TheGardenMonkey, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@iprak fyi since you have another in flight vesync PR. I don't think they clash but wanted you to see this. Open to recommendations to simplify this. |
What a coincidence. I had fixed this locally as well by saving off the platforms actually used.
|
I was looking at that approach but this section of code updates platforms so needs to also be updated. https://github.com/cdnninja/core/blob/0ad8c4afff72c3eab55a9253c186b2023cf90991/homeassistant/components/vesync/__init__.py#L75-L127 So figured lots of lines of code. I am good with either approach though! |
I missed that. Yes, your change will cover that as well. |
in_use_platforms = [] | ||
if hass.data[DOMAIN][VS_SWITCHES]: | ||
in_use_platforms.append(Platform.SWITCH) | ||
if hass.data[DOMAIN][VS_FANS]: | ||
in_use_platforms.append(Platform.FAN) | ||
if hass.data[DOMAIN][VS_LIGHTS]: | ||
in_use_platforms.append(Platform.LIGHT) | ||
if hass.data[DOMAIN][VS_SENSORS]: | ||
in_use_platforms.append(Platform.SENSOR) |
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.
For a future iteration, I would strong suggest to actually just move the detection on what to add to the platforms, this way you can just load all platforms, and then if a platform is not relevant, you can just not add entities
Proposed change
Vesync errors on reload because in some cases not all platforms are used. The old code referenced the total platform list vs the in use list. Not sure if a more elegant way exists to get this data but this works. I was able to replicate the error and confirm resolved in my dev container.
This is referenced regularly as the error:
ValueError: Config entry was never loaded!
Example issues:
#131781
#131409
Type of change
Additional information
This PR fixes or closes issue: fixes #
This PR is related to issue: VeSync not getting Devices #131409, VeSync gets devices but no relevant entities #131781
Link to documentation pull request:
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
.To help with the load of incoming pull requests: