-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Only compute homekit_controller accessory_info when entity is added or config changes #102145
Conversation
These values are never overridden by child classes but they have to be calculated each time the property is called
Hey there @Jc2k, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely want to avoid this yes.
So they were originally done like this for the same reason as the other dynamic props. Their "lifetime" is only until c# changes. (A new entity map is created rather than updating the existing one in place).
It does still feel weird to have old versions of these objects loaded. But I'm not sure that it will make the behaviour any worse:
- If entities get removed from the accessory db, we suck either way
- iids shouldn't change
I guess we wouldn't pick up any feature changes or min/max changes or any of that. I think I saw an arch issue for supporting those sorts of things now, but they should be static atm.
I guess ideally we'd have a callback from HKdevice that lets us update these attrs on a c# change. That would be where the other dynamic attributes could be set when the arch issue is resolved.
I added that but just for the ones here to start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was quick! Nice!
manual testing looks good. It looks like we already have a |
I'll draft this and come up with a test tomorrow. Its getting late for me |
I think we could build on this in a future PR to remove entities when they are removed from a bridge similar to how esphome does it Something to think about. Gnight |
I tried to add a test for removing features at runtime but it fails on
|
If the CI passes, I'll get this merged, and work on a new PR to see if I can make removes better |
Sounds good. Ping me if you need a follow up explicit +1; but extra changes all look good. 👍 |
I think I'll need to change aiohomekit's testing a bit for removes as the failure is there.. but it might be more than |
Proposed change
These values are never overridden by child classes but they have to be calculated each time the property
is called
Noticed this while trying to come up with a solution for #99088 (comment)
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: