Add LogBook support to HomeKit (#17180)

This commit is contained in:
ehendrix23 2018-10-16 05:32:53 -06:00 committed by cdce8p
parent 71ab8a9b1a
commit fee87cd6ed
22 changed files with 327 additions and 66 deletions

View file

@ -3,6 +3,9 @@ from unittest.mock import patch
import pytest
from homeassistant.components.homekit.const import EVENT_HOMEKIT_CHANGED
from homeassistant.core import callback
from pyhap.accessory_driver import AccessoryDriver
@ -14,3 +17,13 @@ def hk_driver():
patch('pyhap.accessory_driver.HAPServer'), \
patch('pyhap.accessory_driver.AccessoryDriver.publish'):
return AccessoryDriver(pincode=b'123-45-678', address='127.0.0.1')
@pytest.fixture
def events(hass):
"""Yield caught homekit_changed events."""
events = []
hass.bus.async_listen(
EVENT_HOMEKIT_CHANGED,
callback(lambda e: events.append(e)))
yield events