entity_registry_updated
events have old values under the "changes" key, rather than the new (changed) values
#134613
Labels
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 underevent: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 aconfig/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
tonew_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
The text was updated successfully, but these errors were encountered: