ikalchev / HAP-python

A python implementation of the HomeKit Accessory Protocol (HAP)
Other
607 stars 116 forks source link

Add support for a custom iid manager #423

Closed bdraco closed 1 year ago

bdraco commented 1 year ago

Currently we rely on creation order to keep iids the same but this is not reliable since services and chars can change. To solve this we need a custom iid manager that tracks iid between restarts to ensure that iids remain stable for the lifetime of the accessory.

Needed to fix (only a small part) https://github.com/home-assistant/core/issues/78092 via https://github.com/home-assistant/core/pull/79913

codecov[bot] commented 1 year ago

Codecov Report

Merging #423 (b4bdd15) into dev (fbd1f4b) will increase coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #423      +/-   ##
==========================================
+ Coverage   91.78%   91.82%   +0.03%     
==========================================
  Files          20       20              
  Lines        2119     2128       +9     
  Branches      287      263      -24     
==========================================
+ Hits         1945     1954       +9     
  Misses        132      132              
  Partials       42       42              
Impacted Files Coverage Δ
pyhap/accessory.py 96.68% <100.00%> (+0.04%) :arrow_up:
pyhap/camera.py 77.21% <100.00%> (ø)
pyhap/characteristic.py 100.00% <100.00%> (ø)
pyhap/iid_manager.py 100.00% <100.00%> (ø)
pyhap/service.py 100.00% <100.00%> (ø)
pyhap/util.py 100.00% <100.00%> (ø)
tillsteinbach commented 1 year ago

How can I set the unique_id for the AccessoryInformation Service when using the "set_info_service" method?