-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Entity registry doesn't overwrite with None #24275
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
Conversation
@@ -127,8 +127,8 @@ def async_get_or_create(self, domain, platform, unique_id, *, | |||
if entity_id: | |||
return self._async_update_entity( | |||
entity_id, | |||
config_entry_id=config_entry_id, | |||
device_id=device_id, | |||
config_entry_id=config_entry_id or _UNDEF, |
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 the better solution is to use _UNDEF
instead of None
as the default value.
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.
There was some reason why I didn't, I can't really remember why though. Will double check.
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.
Did you double check? :)
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 what it came down to was that if you made _UNDEF
the default instead of None
, then further down when you're calling the RegistryEntry
constructor you'd have to use something like None if device_id is _UNDEF else device_id
.
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 it's good to go.
* dev: (87 commits) Add atome sensor platform (home-assistant#26197) Replaces IOError by OSError (home-assistant#26428) Entity registry doesn't overwrite with None (home-assistant#24275) Add device to mqtt camera (home-assistant#26238) Updated frontend to 20190904.0 (home-assistant#26421) Add prettier to vscode (home-assistant#26417) NSW Rural Fire Service icon for geolocation entities (home-assistant#26416) Update azure-pipelines-translation.yml for Azure Pipelines [ci skip] Translation update Update azure-pipelines-translation.yml for Azure Pipelines Update azure-pipelines-translation.yml for Azure Pipelines Update azure-pipelines-translation.yml for Azure Pipelines Update azure-pipelines-translation.yml for Azure Pipelines Bumped version to 0.98.3 Bump ISY994's PyISY dependency to 1.1.2 (home-assistant#26413) Fix state report (home-assistant#26406) Update to 0.1.13 (home-assistant#26402) Met, check for existing location (home-assistant#26400) Allow core config updated (home-assistant#26398) Fix race during initial Sonos group construction (home-assistant#26371) ...
Description:
Little patch to entity registry.
Checklist:
tox
. Your PR cannot be merged unless tests pass