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:
1 parent
6e0186fd56
commit
3e9376c418
3 files changed
+33
-8
No files matched your search
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user