8000 Entity registry doesn't overwrite with None by Swamp-Ig · Pull Request #24275 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 1 commit into from
Sep 4, 2019

Conversation

Swamp-Ig
Copy link
Contributor
@Swamp-Ig Swamp-Ig commented Jun 3, 2019

Description:

Little patch to entity registry.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

@Swamp-Ig Swamp-Ig requested a review from a team as a code owner June 3, 2019 08:57
@homeassistant homeassistant added cla-signed core small-pr PRs with less than 30 lines. labels Jun 3, 2019
@@ -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,
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you double check? :)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@MartinHjelmare
Copy link
Member

@balloob @Swamp-Ig what's the status here? Are we good or should we close?

@balloob balloob merged commit 4004879 into home-assistant:dev Sep 4, 2019
pgilad added a commit to pgilad/home-assistant that referenced this pull request Sep 4, 2019
* 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)
  ...
@balloob balloob mentioned this pull request Sep 18, 2019
@Swamp-Ig Swamp-Ig deleted the registry-not-overwrite branch August 24, 2022 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed core small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0