Skip to content
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

Fix condition in entity.py for entity registry update event handling #25374

Merged

Conversation

@dmulcahey
Copy link
Contributor

commented Jul 21, 2019

Description:

I may be wrong here so feel free to close this if I am but I think the condition here:

if data['action'] != 'update' and data.get(
'old_entity_id', data['entity_id']) != self.entity_id:
return
is incorrect.

I think this is trying to say: return if this is not an update OR if the update is not for me but as currently written it says return if this is not an update AND the update is not for me... that causes any entity update event (such as changing an entity id) to remove and re-add all entities in the system.

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][dev-checklist]

@dmulcahey dmulcahey added this to the 0.96.3 milestone Jul 21, 2019

@dmulcahey dmulcahey requested a review from balloob Jul 21, 2019

@dmulcahey dmulcahey requested a review from home-assistant/core as a code owner Jul 21, 2019

@dmulcahey dmulcahey changed the title Fix condition in entity.py for entity reg update event handling Fix condition in entity.py for entity registry update event handling Jul 21, 2019

@balloob
Copy link
Member

left a comment

Good catch 👍

@balloob balloob merged commit 0653f57 into home-assistant:dev Jul 21, 2019

9 checks passed

CI Build #20190721.34 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python35) Tests PyTest Python35 succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA

balloob added a commit that referenced this pull request Jul 21, 2019

@balloob balloob referenced this pull request Jul 21, 2019
@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Jul 21, 2019

Should there be a test for this?

@lock lock bot locked and limited conversation to collaborators Jul 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.