Add support for homekit controller sensors (#21535)

Adds support for homekit devices with temperature, humidity, and
light level characteristics (such as the iHome iSS50)
This commit is contained in:
cpopp authored and Paulus Schoutsen committed 2019-02-28 10:09:04 -08:00
1 parent 82bdd9568d
commit 84b84559a4
4 files changed
+240 -2

No files matched your search

@@ -134,10 +134,12 @@ class FakeService(AbstractService):
return char
async def setup_test_component(hass, services, capitalize=False):
async def setup_test_component(hass, services, capitalize=False, suffix=None):
"""Load a fake homekit accessory based on a homekit accessory model.
If capitalize is True, property names will be in upper case.
If suffix is set, entityId will include the suffix
"""
domain = None
for service in services:
@@ -174,4 +176,5 @@ async def setup_test_component(hass, services, capitalize=False):
fire_service_discovered(hass, SERVICE_HOMEKIT, discovery_info)
await hass.async_block_till_done()
return Helper(hass, '.'.join((domain, 'testdevice')), pairing, accessory)
entity = 'testdevice' if suffix is None else 'testdevice_{}'.format(suffix)
return Helper(hass, '.'.join((domain, entity)), pairing, accessory)