mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Increment the homekit config version when restarting (#47209)
If an entity changes between restart the iOS/controller device may have cached the old chars for the accessory. To force the iOS/controller to reload the chars, we increment the config version when Home Assistant restarts
This commit is contained in:
parent
0e9f2dc272
commit
853da40e70
@ -491,8 +491,11 @@ class HomeKit:
|
||||
# as pyhap uses a random one until state is restored
|
||||
if os.path.exists(persist_file):
|
||||
self.driver.load()
|
||||
else:
|
||||
self.driver.persist()
|
||||
self.driver.state.config_version += 1
|
||||
if self.driver.state.config_version > 65535:
|
||||
self.driver.state.config_version = 1
|
||||
|
||||
self.driver.persist()
|
||||
|
||||
def reset_accessories(self, entity_ids):
|
||||
"""Reset the accessory to load the latest configuration."""
|
||||
|
@ -540,6 +540,7 @@ async def test_homekit_start(hass, hk_driver, device_reg):
|
||||
assert (device_registry.CONNECTION_NETWORK_MAC, formatted_mac) in device.connections
|
||||
|
||||
assert len(device_reg.devices) == 1
|
||||
assert homekit.driver.state.config_version == 2
|
||||
|
||||
|
||||
async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, mock_zeroconf):
|
||||
|
Loading…
x
Reference in New Issue
Block a user