-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Fix derivative migration from 'none' unit_prefix #147820
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
base: dev
Are you sure you want to change the base?
Conversation
Hey there @afaucogney, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
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 think this looks fine.
) | ||
async def test_options( | ||
hass: HomeAssistant, platform, initial_unit_prefix, minor_version | ||
) -> 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.
I think you should have just added a migration test in test_init.py instead of this to be honest.
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.
Yeah I like that better too, moved 👍
Proposed change
In #101312, the option "none" was removed from derivative unit_prefix.
A migration was added to the sensor creation to treat "none" as
None
, but this wasn't completely handled in the options flow.Legacy sensors with their option still set to
"none"
still cause a problem when showing the options form, as frontend would try to resubmit"none"
as an option when changing a different field, causing a cryptic error.This change completes the missing migration step by deleting the
"none"
key when presenting the options form, so that the key is removed from config_entry when the options form is resubmitted.Also adds coverage that was previously missing covering the migration.
Type of change
Additional information
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: