Handle capitalized HomeKit property names (#21382)

The Velux ACTIVE gateway uses `C#` rather than `c#` as the name of
the property that holds the count of accessories. Apple's HomeKit docs
suggest that properties should be case-insensitive, so update the
code to not assume the property names are lower case.
This commit is contained in:
koreth 2019-02-24 04:56:52 -08:00 committed by Martin Hjelmare
parent 6e0186fd56
commit 3e9376c418
3 changed files with 33 additions and 8 deletions

View file

@ -134,8 +134,11 @@ class FakeService(AbstractService):
return char
async def setup_test_component(hass, services):
"""Load a fake homekit accessory based on a homekit accessory model."""
async def setup_test_component(hass, services, capitalize=False):
"""Load a fake homekit accessory based on a homekit accessory model.
If capitalize is True, property names will be in upper case.
"""
domain = None
for service in services:
service_name = ServicesTypes.get_short(service.type)
@ -162,9 +165,9 @@ async def setup_test_component(hass, services):
'host': '127.0.0.1',
'port': 8080,
'properties': {
'md': 'TestDevice',
'id': '00:00:00:00:00:00',
'c#': 1,
('MD' if capitalize else 'md'): 'TestDevice',
('ID' if capitalize else 'id'): '00:00:00:00:00:00',
('C#' if capitalize else 'c#'): 1,
}
}