Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Entity to handle updates via events #24733
Entity registry used to keep a weak ref to an update method to allow entities to listen for when the entry was updated. This PR migrates that approach to instead listen for the entity registry updated events.
This did introduce a bit of an "Oh" moment: entities need to listen for updates when added to Home Assistant. However, the majority (90+%) of the integrations that implement
So this PR introduces internal versions of the add and remove lifecycle callbacks. Not to be used by integrations. This will guarantee us that the right code is being called and can safely rely on it.
If the code does not interact with devices:
pvizeli left a comment
I think we should split the Entity Object. All function they are not interested by developers for integration should lands into an object i.e. EntityCore and that will be inherited from Entity they represent what devs need can overload.