Bump HAP-python to 4.1.0 (#55005)

This commit is contained in:
J. Nick Koston 2021-08-23 14:00:26 -05:00 committed by GitHub
parent a5c1fbcb1a
commit 99465f53c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 16 deletions

View file

@ -532,11 +532,6 @@ class HomeKit:
# as pyhap uses a random one until state is restored
if os.path.exists(persist_file):
self.driver.load()
self.driver.state.config_version += 1
if self.driver.state.config_version > 65535:
self.driver.state.config_version = 1
self.driver.persist()
async def async_reset_accessories(self, entity_ids):
"""Reset the accessory to load the latest configuration."""
@ -688,6 +683,7 @@ class HomeKit:
self._async_register_bridge()
_LOGGER.debug("Driver start for %s", self._name)
await self.driver.async_start()
self.driver.async_persist()
self.status = STATUS_RUNNING
if self.driver.state.paired:

View file

@ -528,9 +528,9 @@ class HomeDriver(AccessoryDriver):
self._bridge_name = bridge_name
self._entry_title = entry_title
def pair(self, client_uuid, client_public):
def pair(self, client_uuid, client_public, client_permissions):
"""Override super function to dismiss setup message if paired."""
success = super().pair(client_uuid, client_public)
success = super().pair(client_uuid, client_public, client_permissions)
if success:
dismiss_setup_message(self.hass, self._entry_id)
return success

View file

@ -3,7 +3,7 @@
"name": "HomeKit",
"documentation": "https://www.home-assistant.io/integrations/homekit",
"requirements": [
"HAP-python==4.0.0",
"HAP-python==4.1.0",
"fnvhash==0.1.0",
"PyQRCode==1.2.1",
"base36==0.1.1"

View file

@ -14,7 +14,7 @@ Adafruit-SHT31==1.0.2
# Adafruit_BBIO==1.1.1
# homeassistant.components.homekit
HAP-python==4.0.0
HAP-python==4.1.0
# homeassistant.components.mastodon
Mastodon.py==1.5.1

View file

@ -7,7 +7,7 @@
AEMET-OpenData==0.2.1
# homeassistant.components.homekit
HAP-python==4.0.0
HAP-python==4.1.0
# homeassistant.components.flick_electric
PyFlick==0.0.2

View file

@ -696,9 +696,9 @@ def test_home_driver():
with patch("pyhap.accessory_driver.AccessoryDriver.pair") as mock_pair, patch(
"homeassistant.components.homekit.accessories.dismiss_setup_message"
) as mock_dissmiss_msg:
driver.pair("client_uuid", "client_public")
driver.pair("client_uuid", "client_public", b"1")
mock_pair.assert_called_with("client_uuid", "client_public")
mock_pair.assert_called_with("client_uuid", "client_public", b"1")
mock_dissmiss_msg.assert_called_with("hass", "entry_id")
# unpair

View file

@ -560,7 +560,7 @@ async def test_homekit_start(hass, hk_driver, mock_zeroconf, 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
assert homekit.driver.state.config_version == 1
async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, mock_zeroconf):
@ -695,7 +695,7 @@ async def test_homekit_unpair(hass, device_reg, mock_zeroconf):
homekit.status = STATUS_RUNNING
state = homekit.driver.state
state.paired_clients = {"client1": "any"}
state.add_paired_client("client1", "any", b"1")
formatted_mac = device_registry.format_mac(state.mac)
hk_bridge_dev = device_reg.async_get_device(
{}, {(device_registry.CONNECTION_NETWORK_MAC, formatted_mac)}
@ -734,7 +734,7 @@ async def test_homekit_unpair_missing_device_id(hass, device_reg, mock_zeroconf)
homekit.status = STATUS_RUNNING
state = homekit.driver.state
state.paired_clients = {"client1": "any"}
state.add_paired_client("client1", "any", b"1")
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
DOMAIN,
@ -780,7 +780,7 @@ async def test_homekit_unpair_not_homekit_device(hass, device_reg, mock_zeroconf
)
state = homekit.driver.state
state.paired_clients = {"client1": "any"}
state.add_paired_client("client1", "any", b"1")
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
DOMAIN,