-
Notifications
You must be signed in to change notification settings - Fork 50
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 for accessory configuration on restart #62
base: master
Are you sure you want to change the base?
Conversation
Yeah this has been bugging me as well. However the solution proposed would assume that after reinstantiating the device, the configuration hasn't changed. This isn't true as well, one could've changed the accessories / services / characteristics. I think we should generate and store a hash value of the current device setup. We can then compare the hash after instantiation, and only when it differs, update the configuration number. To achieve this, we could create a property that returns a hash value that is build off the cascading tree of elements. (device -> accessories* -> services* -> characteristics*). What do you think? |
See also commit 30e8c26, where I implemented this idea. How does that work for you? |
5a13362
to
b3bc6bc
Compare
The stableHash is a great idea. I have modified accordingly. The initial value for |
There seems to be a problem with travis, so the second check failed for an unknown reason. |
So with the other changes, this PR mostly adds the |
Yes, what is left in this PR essentially adds a new method to |
So the autodiscovery is something that's done by an external factor, I think? Wouldn't it be clearer that this external factor signal the update to the UI itself? |
The auto discovery is performed by a HAP device, independently from the top-level application. It is useful for the owner |
de2593d
to
acc172a
Compare
I've rebased this PR on the current master, so is now compatible with the nio network stack |
The tests are failing due some travis error - it seems one of the test subsystem dependencies has an expired key. |
Ok I'm on board with this change. So maybe we also want to be able to remove accessories from the device? Then we would get these two delegate methods (replacing
What do you think? |
I don't see any harm in splitting into two separate callbacks, however do you propose the function is called for every single accessory added or removed ? Perhaps it may be better to pass the array of accessories added or removed by For my own use, which is to update a UI representation, it doesn't matter what has changed, just that something has changed. I reconstruct a table view based on the entire accessory list when didChangeAccessoryList() is called. For this purpose, there is no benefit to split into two different callbacks, as the additional information provided is not used. |
613e2b4
to
5c989b5
Compare
I have rebased on the latest master and added additional methods to the delegate to pass the list of devices added or removed for those who need it. I have kept the simple notification method, because there is no need to know the specific changes when updating the UI, the current list whatever it is is just redrawn. Can we integrate into master please ? |
Split out from PR #59
Prior to this fix, restarting a bridge incremented the configuration count each time, causing HomeKit to forget room settings.
Add didChangeAccessoryList to DeviceDelegate.