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

entity_registry_updated events have old values under the "changes" key, rather than the new (changed) values #134613

Open
jamalex opened this issue Jan 4, 2025 · 0 comments
Labels

Comments

@jamalex
Copy link

jamalex commented Jan 4, 2025

The problem

Apologies in advance if I'm misinterpreting the intention of some of these endpoints, as this is my first time digging into the backend of HA.

I'm consuming the websocket API from a Python script, and have subscribed to entity_registry_updated events. I then change an entity's friendly name in the HA frontend from "A" to "B", and I receive an event through the websocket as expected. However, the value in the returned object under event:data:changes:name is the old value of the friendly name ("A"), rather than the new value ("B"). And if I now change it to "C", an event is fired giving me the previous value "B".

From tracing the git history, it looks as if this issue was likely introduced here in this commit, and survived some refactors to still be extant on the dev branch here.

The reason this doesn't affect the HA frontend is that every time it receives an entity_registry_updated event, it does a full refresh of the entity registry via a config/entity_registry/list_for_display call.

I'm assuming this is also the reason for issue #61750 reported in 2021.

Given the frontend doesn't seem to depend on the current quirky behavior (as noted above), it's hopefully low risk to update this line from old_values to new_values?

The same condition seems to apply for the device registry.

What version of Home Assistant Core has the issue?

core-2024.12.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

@joostlek joostlek added the core label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants