Upgrade HAP-python to 3.5.0 (#51261)
* Upgrade HAP-python to 3.4.2 - Fixes for malformed event sending - Performance improvements * Bump * update tests to point to async
This commit is contained in:
parent
5a4add6437
commit
0e7c2cddf7
7 changed files with 19 additions and 16 deletions
|
@ -456,7 +456,7 @@ class HomeKit:
|
|||
self.bridge = None
|
||||
self.driver = None
|
||||
|
||||
def setup(self, zeroconf_instance):
|
||||
def setup(self, async_zeroconf_instance):
|
||||
"""Set up bridge and accessory driver."""
|
||||
ip_addr = self._ip_address or get_local_ip()
|
||||
persist_file = get_persist_fullpath_for_entry_id(self.hass, self._entry_id)
|
||||
|
@ -471,7 +471,7 @@ class HomeKit:
|
|||
port=self._port,
|
||||
persist_file=persist_file,
|
||||
advertised_address=self._advertise_ip,
|
||||
zeroconf_instance=zeroconf_instance,
|
||||
async_zeroconf_instance=async_zeroconf_instance,
|
||||
)
|
||||
|
||||
# If we do not load the mac address will be wrong
|
||||
|
@ -595,8 +595,8 @@ class HomeKit:
|
|||
if self.status != STATUS_READY:
|
||||
return
|
||||
self.status = STATUS_WAIT
|
||||
zc_instance = await zeroconf.async_get_instance(self.hass)
|
||||
await self.hass.async_add_executor_job(self.setup, zc_instance)
|
||||
async_zc_instance = await zeroconf.async_get_async_instance(self.hass)
|
||||
await self.hass.async_add_executor_job(self.setup, async_zc_instance)
|
||||
self.aid_storage = AccessoryAidStorage(self.hass, self._entry_id)
|
||||
await self.aid_storage.async_initialize()
|
||||
await self._async_create_accessories()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "HomeKit",
|
||||
"documentation": "https://www.home-assistant.io/integrations/homekit",
|
||||
"requirements": [
|
||||
"HAP-python==3.4.1",
|
||||
"HAP-python==3.5.0",
|
||||
"fnvhash==0.1.0",
|
||||
"PyQRCode==1.2.1",
|
||||
"base36==0.1.1",
|
||||
|
|
|
@ -14,7 +14,7 @@ Adafruit-SHT31==1.0.2
|
|||
# Adafruit_BBIO==1.1.1
|
||||
|
||||
# homeassistant.components.homekit
|
||||
HAP-python==3.4.1
|
||||
HAP-python==3.5.0
|
||||
|
||||
# homeassistant.components.mastodon
|
||||
Mastodon.py==1.5.1
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
AEMET-OpenData==0.2.1
|
||||
|
||||
# homeassistant.components.homekit
|
||||
HAP-python==3.4.1
|
||||
HAP-python==3.5.0
|
||||
|
||||
# homeassistant.components.flick_electric
|
||||
PyFlick==0.0.2
|
||||
|
|
|
@ -12,7 +12,7 @@ from tests.common import async_capture_events
|
|||
@pytest.fixture
|
||||
def hk_driver(loop):
|
||||
"""Return a custom AccessoryDriver instance for HomeKit accessory init."""
|
||||
with patch("pyhap.accessory_driver.Zeroconf"), patch(
|
||||
with patch("pyhap.accessory_driver.AsyncZeroconf"), patch(
|
||||
"pyhap.accessory_driver.AccessoryEncoder"
|
||||
), patch("pyhap.accessory_driver.HAPServer.async_stop"), patch(
|
||||
"pyhap.accessory_driver.HAPServer.async_start"
|
||||
|
|
|
@ -250,7 +250,7 @@ async def test_homekit_setup(hass, hk_driver, mock_zeroconf):
|
|||
port=DEFAULT_PORT,
|
||||
persist_file=path,
|
||||
advertised_address=None,
|
||||
zeroconf_instance=zeroconf_mock,
|
||||
async_zeroconf_instance=zeroconf_mock,
|
||||
)
|
||||
assert homekit.driver.safe_mode is False
|
||||
|
||||
|
@ -290,7 +290,7 @@ async def test_homekit_setup_ip_address(hass, hk_driver, mock_zeroconf):
|
|||
port=DEFAULT_PORT,
|
||||
persist_file=path,
|
||||
advertised_address=None,
|
||||
zeroconf_instance=mock_zeroconf,
|
||||
async_zeroconf_instance=mock_zeroconf,
|
||||
)
|
||||
|
||||
|
||||
|
@ -315,10 +315,10 @@ async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_zeroconf):
|
|||
entry_title=entry.title,
|
||||
)
|
||||
|
||||
zeroconf_instance = MagicMock()
|
||||
async_zeroconf_instance = MagicMock()
|
||||
path = get_persist_fullpath_for_entry_id(hass, entry.entry_id)
|
||||
with patch(f"{PATH_HOMEKIT}.HomeDriver", return_value=hk_driver) as mock_driver:
|
||||
await hass.async_add_executor_job(homekit.setup, zeroconf_instance)
|
||||
await hass.async_add_executor_job(homekit.setup, async_zeroconf_instance)
|
||||
mock_driver.assert_called_with(
|
||||
hass,
|
||||
entry.entry_id,
|
||||
|
@ -329,7 +329,7 @@ async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_zeroconf):
|
|||
port=DEFAULT_PORT,
|
||||
persist_file=path,
|
||||
advertised_address="192.168.1.100",
|
||||
zeroconf_instance=zeroconf_instance,
|
||||
async_zeroconf_instance=async_zeroconf_instance,
|
||||
)
|
||||
|
||||
|
||||
|
@ -851,7 +851,7 @@ async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf):
|
|||
options={},
|
||||
)
|
||||
assert await async_setup_component(hass, "zeroconf", {"zeroconf": {}})
|
||||
system_zc = await zeroconf.async_get_instance(hass)
|
||||
system_async_zc = await zeroconf.async_get_async_instance(hass)
|
||||
|
||||
with patch("pyhap.accessory_driver.AccessoryDriver.async_start"), patch(
|
||||
f"{PATH_HOMEKIT}.HomeKit.async_stop"
|
||||
|
@ -859,7 +859,10 @@ async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf):
|
|||
entry.add_to_hass(hass)
|
||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert hass.data[DOMAIN][entry.entry_id][HOMEKIT].driver.advertiser == system_zc
|
||||
assert (
|
||||
hass.data[DOMAIN][entry.entry_id][HOMEKIT].driver.advertiser
|
||||
== system_async_zc
|
||||
)
|
||||
assert await hass.config_entries.async_unload(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ async def _async_stop_stream(hass, acc, session_info):
|
|||
@pytest.fixture()
|
||||
def run_driver(hass):
|
||||
"""Return a custom AccessoryDriver instance for HomeKit accessory init."""
|
||||
with patch("pyhap.accessory_driver.Zeroconf"), patch(
|
||||
with patch("pyhap.accessory_driver.AsyncZeroconf"), patch(
|
||||
"pyhap.accessory_driver.AccessoryEncoder"
|
||||
), patch("pyhap.accessory_driver.HAPServer"), patch(
|
||||
"pyhap.accessory_driver.AccessoryDriver.publish"
|
||||
|
|
Loading…
Add table
Reference in a new issue