diff --git a/tests/components/homekit_controller/common.py b/tests/components/homekit_controller/common.py index 2d659d42dfb..4da7bc00c85 100644 --- a/tests/components/homekit_controller/common.py +++ b/tests/components/homekit_controller/common.py @@ -1,5 +1,6 @@ """Code to support homekit_controller tests.""" import json +import os from datetime import timedelta from unittest import mock @@ -13,7 +14,8 @@ from homeassistant.components.homekit_controller.const import ( DOMAIN, HOMEKIT_ACCESSORY_DISPATCH) from homeassistant.setup import async_setup_component import homeassistant.util.dt as dt_util -from tests.common import async_fire_time_changed, fire_service_discovered +from tests.common import ( + async_fire_time_changed, fire_service_discovered, load_fixture) class FakePairing: @@ -149,10 +151,13 @@ class FakeService(AbstractService): return char -def setup_accessories_from_file(path): +async def setup_accessories_from_file(hass, path): """Load an collection of accessory defs from JSON data.""" - with open(path, 'r') as accessories_data: - accessories_json = json.load(accessories_data) + accessories_fixture = await hass.async_add_executor_job( + load_fixture, + os.path.join('homekit_controller', path), + ) + accessories_json = json.loads(accessories_fixture) accessories = [] diff --git a/tests/components/homekit_controller/specific_devices/test_aqara_gateway.py b/tests/components/homekit_controller/specific_devices/test_aqara_gateway.py new file mode 100644 index 00000000000..e0738d67083 --- /dev/null +++ b/tests/components/homekit_controller/specific_devices/test_aqara_gateway.py @@ -0,0 +1,41 @@ +""" +Regression tests for Aqara Gateway V3. + +https://github.com/home-assistant/home-assistant/issues/20957 +""" + +from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_COLOR +from tests.components.homekit_controller.common import ( + setup_accessories_from_file, setup_test_accessories, Helper +) + + +async def test_aqara_gateway_setup(hass): + """Test that a Aqara Gateway can be correctly setup in HA.""" + accessories = await setup_accessories_from_file( + hass, 'aqara_gateway.json') + pairing = await setup_test_accessories(hass, accessories) + + entity_registry = await hass.helpers.entity_registry.async_get_registry() + + # Check that the light is correctly found and set up + alarm_id = "alarm_control_panel.aqara_hub_1563" + alarm = entity_registry.async_get(alarm_id) + assert alarm.unique_id == 'homekit-0000000123456789-66304' + + alarm_helper = Helper( + hass, 'alarm_control_panel.aqara_hub_1563', pairing, accessories[0]) + alarm_state = await alarm_helper.poll_and_get_state() + assert alarm_state.attributes['friendly_name'] == 'Aqara Hub-1563' + + # Check that the light is correctly found and set up + light = entity_registry.async_get('light.aqara_hub_1563') + assert light.unique_id == 'homekit-0000000123456789-65792' + + light_helper = Helper( + hass, 'light.aqara_hub_1563', pairing, accessories[0]) + light_state = await light_helper.poll_and_get_state() + assert light_state.attributes['friendly_name'] == 'Aqara Hub-1563' + assert light_state.attributes['supported_features'] == ( + SUPPORT_BRIGHTNESS | SUPPORT_COLOR + ) diff --git a/tests/components/homekit_controller/specific_devices/test_ecobee3.py b/tests/components/homekit_controller/specific_devices/test_ecobee3.py new file mode 100644 index 00000000000..e9452840074 --- /dev/null +++ b/tests/components/homekit_controller/specific_devices/test_ecobee3.py @@ -0,0 +1,43 @@ +""" +Regression tests for Ecobee 3. + +https://github.com/home-assistant/home-assistant/issues/15336 +""" + +from homeassistant.components.climate.const import ( + SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE) +from tests.components.homekit_controller.common import ( + setup_accessories_from_file, setup_test_accessories, Helper +) + + +async def test_ecobee3_setup(hass): + """Test that a Ecbobee 3 can be correctly setup in HA.""" + accessories = await setup_accessories_from_file(hass, 'ecobee3.json') + pairing = await setup_test_accessories(hass, accessories) + + entity_registry = await hass.helpers.entity_registry.async_get_registry() + + climate = entity_registry.async_get('climate.homew') + assert climate.unique_id == 'homekit-123456789012-16' + + climate_helper = Helper(hass, 'climate.homew', pairing, accessories[0]) + climate_state = await climate_helper.poll_and_get_state() + assert climate_state.attributes['friendly_name'] == 'HomeW' + assert climate_state.attributes['supported_features'] == ( + SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE + ) + + occ1 = entity_registry.async_get('binary_sensor.kitchen') + assert occ1.unique_id == 'homekit-AB1C-56' + + occ1_helper = Helper( + hass, 'binary_sensor.kitchen', pairing, accessories[0]) + occ1_state = await occ1_helper.poll_and_get_state() + assert occ1_state.attributes['friendly_name'] == 'Kitchen' + + occ2 = entity_registry.async_get('binary_sensor.porch') + assert occ2.unique_id == 'homekit-AB2C-56' + + occ3 = entity_registry.async_get('binary_sensor.basement') + assert occ3.unique_id == 'homekit-AB3C-56' diff --git a/tests/components/homekit_controller/specific_devices/test_koogeek_ls1.py b/tests/components/homekit_controller/specific_devices/test_koogeek_ls1.py index 7b7981cf6de..a741885c6d5 100644 --- a/tests/components/homekit_controller/specific_devices/test_koogeek_ls1.py +++ b/tests/components/homekit_controller/specific_devices/test_koogeek_ls1.py @@ -1,6 +1,5 @@ """Make sure that existing Koogeek LS1 support isn't broken.""" -import os from datetime import timedelta from unittest import mock @@ -19,8 +18,7 @@ LIGHT_ON = ('lightbulb', 'on') async def test_koogeek_ls1_setup(hass): """Test that a Koogeek LS1 can be correctly setup in HA.""" - profile_path = os.path.join(os.path.dirname(__file__), 'koogeek_ls1.json') - accessories = setup_accessories_from_file(profile_path) + accessories = await setup_accessories_from_file(hass, 'koogeek_ls1.json') pairing = await setup_test_accessories(hass, accessories) entity_registry = await hass.helpers.entity_registry.async_get_registry() @@ -50,8 +48,7 @@ async def test_recover_from_failure(hass, utcnow, failure_cls): See https://github.com/home-assistant/home-assistant/issues/18949 """ - profile_path = os.path.join(os.path.dirname(__file__), 'koogeek_ls1.json') - accessories = setup_accessories_from_file(profile_path) + accessories = await setup_accessories_from_file(hass, 'koogeek_ls1.json') pairing = await setup_test_accessories(hass, accessories) helper = Helper(hass, 'light.koogeek_ls1_20833f', pairing, accessories[0]) diff --git a/tests/components/homekit_controller/specific_devices/test_lennox_e30.py b/tests/components/homekit_controller/specific_devices/test_lennox_e30.py new file mode 100644 index 00000000000..1869161b1f8 --- /dev/null +++ b/tests/components/homekit_controller/specific_devices/test_lennox_e30.py @@ -0,0 +1,29 @@ +""" +Regression tests for Aqara Gateway V3. + +https://github.com/home-assistant/home-assistant/issues/20885 +""" + +from homeassistant.components.climate.const import ( + SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE) +from tests.components.homekit_controller.common import ( + setup_accessories_from_file, setup_test_accessories, Helper +) + + +async def test_lennox_e30_setup(hass): + """Test that a Lennox E30 can be correctly setup in HA.""" + accessories = await setup_accessories_from_file(hass, 'lennox_e30.json') + pairing = await setup_test_accessories(hass, accessories) + + entity_registry = await hass.helpers.entity_registry.async_get_registry() + + climate = entity_registry.async_get('climate.lennox') + assert climate.unique_id == 'homekit-XXXXXXXX-100' + + climate_helper = Helper(hass, 'climate.lennox', pairing, accessories[0]) + climate_state = await climate_helper.poll_and_get_state() + assert climate_state.attributes['friendly_name'] == 'Lennox' + assert climate_state.attributes['supported_features'] == ( + SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE + ) diff --git a/tests/fixtures/homekit_controller/aqara_gateway.json b/tests/fixtures/homekit_controller/aqara_gateway.json new file mode 100644 index 00000000000..092936f3da5 --- /dev/null +++ b/tests/fixtures/homekit_controller/aqara_gateway.json @@ -0,0 +1,488 @@ +[ + { + "services": [ + { + "iid": 1, + "characteristics": [ + { + "value": "Aqara", + "description": "Manufacturer", + "type": "20", + "iid": 3, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "value": "ZHWA11LM", + "description": "Model", + "type": "21", + "iid": 4, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "value": "Aqara Hub-1563", + "description": "Name", + "type": "23", + "iid": 5, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "value": "0000000123456789", + "description": "Serial Number", + "type": "30", + "iid": 6, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "description": "Identify", + "iid": 7, + "perms": [ + "pw" + ], + "type": "14", + "format": "bool" + }, + { + "value": "1.4.7", + "description": "Firmware Revision", + "type": "52", + "iid": 8, + "perms": [ + "pr" + ], + "format": "string" + } + ], + "type": "3e" + }, + { + "iid": 60, + "characteristics": [ + { + "value": "1.1.0", + "description": "Protocol Version", + "type": "37", + "iid": 62, + "perms": [ + "pr" + ], + "format": "string" + } + ], + "type": "a2" + }, + { + "hidden": true, + "iid": 65536, + "characteristics": [ + { + "value": false, + "description": "New Accessory Permission", + "type": "b1c09e4c-e202-4827-b343-b0f32f727cff", + "iid": 65538, + "perms": [ + "pr", + "pw", + "ev", + "hd" + ], + "format": "bool" + }, + { + "value": "()", + "description": "Accessory Joined", + "type": "2cb22739-1e4c-4798-a712-bc2faf51afc3", + "maxLen": 256, + "iid": 65539, + "perms": [ + "pr", + "ev", + "hd" + ], + "format": "string" + }, + { + "value": " ", + "description": "Remove Accessory", + "type": "75d19fa9-218b-4943-427e-341e5d1c60cc", + "iid": 65540, + "perms": [ + "pr", + "pw", + "ev", + "hd" + ], + "format": "string" + }, + { + "maxValue": 100, + "value": 40, + "minValue": 0, + "description": "Gateway Volume", + "type": "ee56b186-b0d3-528e-8c79-c21fc9bcf437", + "unit": "percentage", + "iid": 65541, + "minStep": 1, + "perms": [ + "pr", + "pw" + ], + "format": "int" + }, + { + "value": "Chinese", + "description": "Language", + "type": "4cf1436a-755c-1277-bdb8-30be29eb8620", + "iid": 65542, + "perms": [ + "pr", + "pw" + ], + "format": "string" + }, + { + "value": "2019-02-12 06:45:07+10", + "description": "Date and Time", + "type": "4cb28907-66df-4d9c-924c-9971abf30edc", + "iid": 65543, + "perms": [ + "pr", + "pw" + ], + "format": "string" + }, + { + "value": " ", + "description": "Identify Accessory", + "type": "e1c20b22-e3a7-4b12-8ba3-c16e778648a7", + "iid": 65544, + "perms": [ + "pr", + "ev", + "hd" + ], + "format": "string" + }, + { + "value": "aiot-coap.aqara.cn", + "description": "Country Domain", + "type": "25d889cb-7135-4a21-b5b4-c1ffd6d2dd5c", + "iid": 65545, + "perms": [ + "pr", + "pw", + "hd" + ], + "format": "string" + }, + { + "value": -1, + "description": "Firmware Update Status", + "type": "7d943f6a-e052-4e96-a124-d17bf00e32cb", + "iid": 65546, + "perms": [ + "pr", + "ev", + "hd" + ], + "format": "int" + }, + { + "description": "Firmware Update Data", + "iid": 65547, + "perms": [ + "pw", + "hd" + ], + "type": "7f51dc43-dc68-4237-bae8-d705e61139f5", + "format": "data" + }, + { + "description": "Firmware Update URL", + "type": "a45efd52-0db5-4c1a-1227-513fbcd8185f", + "maxLen": 256, + "iid": 65548, + "perms": [ + "pw", + "hd" + ], + "format": "string" + }, + { + "description": "Firmware Update Checksum", + "iid": 65549, + "perms": [ + "pw", + "hd" + ], + "type": "40f0124a-579d-40e4-245e-0ef6740ea64b", + "format": "string" + } + ], + "type": "9715bf53-ab63-4449-8dc7-2485d617390a" + }, + { + "iid": 65792, + "characteristics": [ + { + "value": "Lightbulb-1563", + "description": "Name", + "type": "23", + "iid": 65794, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "value": false, + "description": "On", + "type": "25", + "iid": 65795, + "perms": [ + "pr", + "pw", + "ev" + ], + "format": "bool" + }, + { + "maxValue": 360, + "value": 0, + "minValue": 0, + "description": "Hue", + "type": "13", + "unit": "arcdegrees", + "iid": 65796, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "format": "float" + }, + { + "maxValue": 100, + "value": 100, + "minValue": 0, + "description": "Saturation", + "type": "2f", + "unit": "percentage", + "iid": 65797, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "format": "float" + }, + { + "maxValue": 100, + "value": 0, + "minValue": 0, + "description": "Brightness", + "type": "8", + "unit": "percentage", + "iid": 65798, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "format": "int" + }, + { + "value": "", + "description": "Timers", + "type": "232aa6bd-6ce2-4d7f-b7cf-52305f0d2bcf", + "iid": 65799, + "perms": [ + "pr", + "pw", + "hd" + ], + "format": "tlv8" + } + ], + "type": "43" + }, + { + "iid": 66048, + "characteristics": [ + { + "value": "MIIO Service", + "description": "Name", + "type": "23", + "iid": 66050, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "value": false, + "description": "miio provisioned", + "type": "6ef066c1-08f8-46de-9121-b89b77e459e7", + "iid": 66051, + "perms": [ + "pr", + "hd" + ], + "format": "bool" + }, + { + "description": "miio bindkey", + "iid": 66052, + "perms": [ + "pw", + "hd" + ], + "type": "6ef066c2-08f8-46de-9121-b89b77e459e7", + "format": "string" + }, + { + "value": "152601563", + "description": "miio did", + "type": "6ef066c5-08f8-46de-9121-b89b77e459e7", + "iid": 66053, + "perms": [ + "pr", + "hd" + ], + "format": "string" + }, + { + "value": "lumi.gateway.aqhm01", + "description": "miio model", + "type": "6ef066c4-08f8-46de-9121-b89b77e459e7", + "iid": 66054, + "perms": [ + "pr", + "hd" + ], + "format": "string" + }, + { + "value": "ch", + "description": "miio country domain", + "type": "6ef066c3-08f8-46de-9121-b89b77e459e7", + "iid": 66055, + "perms": [ + "pr", + "pw", + "hd" + ], + "format": "string" + }, + { + "value": "country code", + "description": "miio country code", + "type": "6ef066d1-08f8-46de-9121-b89b77e459e7", + "iid": 66056, + "perms": [ + "pr", + "pw", + "hd" + ], + "format": "string" + }, + { + "value": "app", + "description": "miio config type", + "type": "6ef066d3-08f8-46de-9121-b89b77e459e7", + "iid": 66057, + "perms": [ + "pr", + "pw", + "hd" + ], + "format": "string" + }, + { + "value": 28800, + "description": "miio gmt offset", + "type": "6ef066d2-08f8-46de-9121-b89b77e459e7", + "unit": "seconds", + "iid": 66058, + "perms": [ + "pr", + "pw", + "hd" + ], + "format": "int" + } + ], + "type": "6ef066c0-08f8-46de-9121-b89b77e459e7" + }, + { + "iid": 66304, + "characteristics": [ + { + "value": "Security System", + "description": "Name", + "type": "23", + "iid": 66306, + "perms": [ + "pr" + ], + "format": "string" + }, + { + "maxValue": 4, + "value": 3, + "minValue": 0, + "description": "Security System Current State", + "type": "66", + "valid-values": [ + 1, + 3, + 4 + ], + "iid": 66307, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "format": "uint8" + }, + { + "maxValue": 3, + "value": 3, + "minValue": 0, + "description": "Security System Target State", + "type": "67", + "valid-values": [ + 1, + 3 + ], + "iid": 66308, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "format": "uint8" + } + ], + "type": "7e" + } + ], + "aid": 1 + } +] \ No newline at end of file diff --git a/tests/fixtures/homekit_controller/ecobee3.json b/tests/fixtures/homekit_controller/ecobee3.json new file mode 100644 index 00000000000..34c3fb4cdea --- /dev/null +++ b/tests/fixtures/homekit_controller/ecobee3.json @@ -0,0 +1,1036 @@ +[ + { + "aid": 1, + "services": [ + { + "type": "3E", + "characteristics": [ + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 2 + }, + { + "value": "ecobee Inc.", + "perms": [ + "pr" + ], + "type": "20", + "format": "string", + "iid": 3 + }, + { + "value": "123456789012", + "perms": [ + "pr" + ], + "type": "30", + "format": "string", + "iid": 4 + }, + { + "value": "ecobee3", + "perms": [ + "pr" + ], + "type": "21", + "format": "string", + "iid": 5 + }, + { + "perms": [ + "pw" + ], + "type": "14", + "format": "bool", + "iid": 6 + }, + { + "value": "4.2.394", + "perms": [ + "pr" + ], + "type": "52", + "format": "string", + "iid": 8 + }, + { + "value": 0, + "perms": [ + "pr", + "ev" + ], + "type": "A6", + "format": "uint32", + "iid": 9 + } + ], + "iid": 1 + }, + { + "type": "A2", + "characteristics": [ + { + "value": "1.1.0", + "perms": [ + "pr" + ], + "maxLen": 64, + "type": "37", + "format": "string", + "iid": 31 + } + ], + "iid": 30 + }, + { + "primary": true, + "type": "4A", + "characteristics": [ + { + "value": 1, + "maxValue": 2, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "F", + "minValue": 0, + "format": "uint8", + "iid": 17 + }, + { + "value": 1, + "maxValue": 3, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "33", + "minValue": 0, + "format": "uint8", + "iid": 18 + }, + { + "value": 21.8, + "maxValue": 100, + "minStep": 0.1, + "perms": [ + "pr", + "ev" + ], + "unit": "celsius", + "type": "11", + "minValue": 0, + "format": "float", + "iid": 19 + }, + { + "value": 22.2, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "35", + "minValue": 7.2, + "format": "float", + "iid": 20 + }, + { + "value": 1, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "36", + "minValue": 0, + "format": "uint8", + "iid": 21 + }, + { + "value": 24.4, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "D", + "minValue": 18.3, + "format": "float", + "iid": 22 + }, + { + "value": 22.2, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "12", + "minValue": 7.2, + "format": "float", + "iid": 23 + }, + { + "value": 34, + "maxValue": 100, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "unit": "percentage", + "type": "10", + "minValue": 0, + "format": "float", + "iid": 24 + }, + { + "value": 36, + "maxValue": 50, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "percentage", + "type": "34", + "minValue": 20, + "format": "float", + "iid": 25 + }, + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 27 + }, + { + "value": 0, + "perms": [ + "pr", + "ev" + ], + "type": "B7DDB9A3-54BB-4572-91D2-F1F5B0510F8C", + "format": "uint8", + "iid": 33 + }, + { + "value": 22.2, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "E4489BBC-5227-4569-93E5-B345E3E5508F", + "minValue": 7.2, + "format": "float", + "iid": 34 + }, + { + "value": 24.4, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "7D381BAA-20F9-40E5-9BE9-AEB92D4BECEF", + "minValue": 18.3, + "format": "float", + "iid": 35 + }, + { + "value": 17.8, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "73AAB542-892A-4439-879A-D2A883724B69", + "minValue": 7.2, + "format": "float", + "iid": 36 + }, + { + "value": 27.8, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "5DA985F0-898A-4850-B987-B76C6C78D670", + "minValue": 18.3, + "format": "float", + "iid": 37 + }, + { + "value": 18.9, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "05B97374-6DC0-439B-A0FA-CA33F612D425", + "minValue": 7.2, + "format": "float", + "iid": 38 + }, + { + "value": 26.7, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "A251F6E7-AC46-4190-9C5D-3D06277BDF9F", + "minValue": 18.3, + "format": "float", + "iid": 39 + }, + { + "minValue": 0, + "maxValue": 3, + "minStep": 1, + "perms": [ + "pw" + ], + "type": "1B300BC2-CFFC-47FF-89F9-BD6CCF5F2853", + "format": "uint8", + "iid": 40 + }, + { + "value": "2014-01-03T00:00:00-05:00", + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "1621F556-1367-443C-AF19-82AF018E99DE", + "format": "string", + "iid": 41 + }, + { + "perms": [ + "pw" + ], + "type": "FA128DE6-9D7D-49A4-B6D8-4E4E234DEE38", + "format": "bool", + "iid": 48 + }, + { + "value": 1, + "perms": [ + "pr", + "ev" + ], + "type": "4A6AE4F6-036C-495D-87CC-B3702B437741", + "format": "uint8", + "iid": 49 + }, + { + "value": 0, + "perms": [ + "pr", + "ev" + ], + "type": "DB7BF261-7042-4194-8BD1-3AA22830AEDD", + "format": "uint8", + "iid": 50 + }, + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "41935E3E-B54D-42E9-B8B9-D33C6319F0AF", + "format": "bool", + "iid": 51 + }, + { + "minValue": 0, + "maxValue": 100, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "C35DA3C0-E004-40E3-B153-46655CDD9214", + "value": 0, + "format": "uint8", + "iid": 52 + }, + { + "value": 100, + "perms": [ + "pr", + "ev" + ], + "type": "48F62AEC-4171-4B4A-8F0E-1EEB6708B3FB", + "format": "uint8", + "iid": 53 + }, + { + "value": "The Hive is humming along. You have no pending alerts or reminders.", + "perms": [ + "pr", + "ev" + ], + "iid": 54, + "type": "1B1515F2-CC45-409F-991F-C480987F92C3", + "format": "string", + "maxLen": 256 + } + ], + "iid": 16 + }, + { + "type": "85", + "characteristics": [ + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 28 + }, + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "22", + "format": "bool", + "iid": 66 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "BFE61C70-4A40-11E6-BDF4-0800200C9A66", + "value": 2980, + "format": "int", + "iid": 67 + } + ], + "iid": 56 + }, + { + "type": "86", + "characteristics": [ + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 29 + }, + { + "minValue": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "71", + "value": 1, + "format": "uint8", + "iid": 65 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "A8f798E0-4A40-11E6-BDF4-0800200C9A66", + "value": 2980, + "format": "int", + "iid": 68 + } + ], + "iid": 57 + } + ] + }, + { + "aid": 2, + "services": [ + { + "type": "3E", + "characteristics": [ + { + "value": "Kitchen", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 2049 + }, + { + "value": "ecobee Inc.", + "perms": [ + "pr" + ], + "type": "20", + "format": "string", + "iid": 2050 + }, + { + "value": "AB1C", + "perms": [ + "pr" + ], + "type": "30", + "format": "string", + "iid": 2051 + }, + { + "value": "REMOTE SENSOR", + "perms": [ + "pr" + ], + "type": "21", + "format": "string", + "iid": 2052 + }, + { + "value": "1.0.0", + "perms": [ + "pr" + ], + "type": "52", + "format": "string", + "iid": 8 + }, + { + "perms": [ + "pw" + ], + "type": "14", + "format": "bool", + "iid": 2053 + } + ], + "iid": 1 + }, + { + "type": "8A", + "characteristics": [ + { + "value": 21.5, + "maxValue": 100, + "minStep": 0.1, + "perms": [ + "pr", + "ev" + ], + "unit": "celsius", + "type": "11", + "minValue": 0, + "format": "float", + "iid": 2064 + }, + { + "value": "Kitchen", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 2067 + }, + { + "value": true, + "perms": [ + "pr", + "ev" + ], + "type": "75", + "format": "bool", + "iid": 2066 + }, + { + "value": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "79", + "minValue": 0, + "format": "uint8", + "iid": 2065 + } + ], + "iid": 55 + }, + { + "type": "85", + "characteristics": [ + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "22", + "format": "bool", + "iid": 2060 + }, + { + "value": "Kitchen", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 2063 + }, + { + "value": true, + "perms": [ + "pr", + "ev" + ], + "type": "75", + "format": "bool", + "iid": 2062 + }, + { + "minValue": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "79", + "value": 0, + "format": "uint8", + "iid": 2061 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "BFE61C70-4A40-11E6-BDF4-0800200C9A66", + "value": 3620, + "format": "int", + "iid": 2059 + } + ], + "iid": 56 + } + ] + }, + { + "aid": 3, + "services": [ + { + "type": "3E", + "characteristics": [ + { + "value": "Porch", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 3073 + }, + { + "value": "ecobee Inc.", + "perms": [ + "pr" + ], + "type": "20", + "format": "string", + "iid": 3074 + }, + { + "value": "AB2C", + "perms": [ + "pr" + ], + "type": "30", + "format": "string", + "iid": 3075 + }, + { + "value": "REMOTE SENSOR", + "perms": [ + "pr" + ], + "type": "21", + "format": "string", + "iid": 3076 + }, + { + "value": "1.0.0", + "perms": [ + "pr" + ], + "type": "52", + "format": "string", + "iid": 8 + }, + { + "perms": [ + "pw" + ], + "type": "14", + "format": "bool", + "iid": 3077 + } + ], + "iid": 1 + }, + { + "type": "8A", + "characteristics": [ + { + "value": 21, + "maxValue": 100, + "minStep": 0.1, + "perms": [ + "pr", + "ev" + ], + "unit": "celsius", + "type": "11", + "minValue": 0, + "format": "float", + "iid": 3088 + }, + { + "value": "Porch", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 3091 + }, + { + "value": true, + "perms": [ + "pr", + "ev" + ], + "type": "75", + "format": "bool", + "iid": 3090 + }, + { + "value": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "79", + "minValue": 0, + "format": "uint8", + "iid": 3089 + } + ], + "iid": 55 + }, + { + "type": "85", + "characteristics": [ + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "22", + "format": "bool", + "iid": 3084 + }, + { + "value": "Porch", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 3087 + }, + { + "value": true, + "perms": [ + "pr", + "ev" + ], + "type": "75", + "format": "bool", + "iid": 3086 + }, + { + "minValue": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "79", + "value": 0, + "format": "uint8", + "iid": 3085 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "BFE61C70-4A40-11E6-BDF4-0800200C9A66", + "value": 5766, + "format": "int", + "iid": 3083 + } + ], + "iid": 56 + } + ] + }, + { + "aid": 4, + "services": [ + { + "type": "3E", + "characteristics": [ + { + "value": "Basement", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 4097 + }, + { + "value": "ecobee Inc.", + "perms": [ + "pr" + ], + "type": "20", + "format": "string", + "iid": 4098 + }, + { + "value": "AB3C", + "perms": [ + "pr" + ], + "type": "30", + "format": "string", + "iid": 4099 + }, + { + "value": "REMOTE SENSOR", + "perms": [ + "pr" + ], + "type": "21", + "format": "string", + "iid": 4100 + }, + { + "value": "1.0.0", + "perms": [ + "pr" + ], + "type": "52", + "format": "string", + "iid": 8 + }, + { + "perms": [ + "pw" + ], + "type": "14", + "format": "bool", + "iid": 4101 + } + ], + "iid": 1 + }, + { + "type": "8A", + "characteristics": [ + { + "value": 20.7, + "maxValue": 100, + "minStep": 0.1, + "perms": [ + "pr", + "ev" + ], + "unit": "celsius", + "type": "11", + "minValue": 0, + "format": "float", + "iid": 4112 + }, + { + "value": "Basement", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 4115 + }, + { + "value": true, + "perms": [ + "pr", + "ev" + ], + "type": "75", + "format": "bool", + "iid": 4114 + }, + { + "value": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "79", + "minValue": 0, + "format": "uint8", + "iid": 4113 + } + ], + "iid": 55 + }, + { + "type": "85", + "characteristics": [ + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "22", + "format": "bool", + "iid": 4108 + }, + { + "value": "Basement", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 4111 + }, + { + "value": true, + "perms": [ + "pr", + "ev" + ], + "type": "75", + "format": "bool", + "iid": 4110 + }, + { + "minValue": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "79", + "value": 0, + "format": "uint8", + "iid": 4109 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "BFE61C70-4A40-11E6-BDF4-0800200C9A66", + "value": 5472, + "format": "int", + "iid": 4107 + } + ], + "iid": 56 + } + ] + } +] \ No newline at end of file diff --git a/tests/fixtures/homekit_controller/ecobee3_no_sensors.json b/tests/fixtures/homekit_controller/ecobee3_no_sensors.json new file mode 100644 index 00000000000..3d3c2ebad2b --- /dev/null +++ b/tests/fixtures/homekit_controller/ecobee3_no_sensors.json @@ -0,0 +1,508 @@ +[ + { + "aid": 1, + "services": [ + { + "type": "3E", + "characteristics": [ + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 2 + }, + { + "value": "ecobee Inc.", + "perms": [ + "pr" + ], + "type": "20", + "format": "string", + "iid": 3 + }, + { + "value": "123456789012", + "perms": [ + "pr" + ], + "type": "30", + "format": "string", + "iid": 4 + }, + { + "value": "ecobee3", + "perms": [ + "pr" + ], + "type": "21", + "format": "string", + "iid": 5 + }, + { + "perms": [ + "pw" + ], + "type": "14", + "format": "bool", + "iid": 6 + }, + { + "value": "4.2.394", + "perms": [ + "pr" + ], + "type": "52", + "format": "string", + "iid": 8 + }, + { + "value": 0, + "perms": [ + "pr", + "ev" + ], + "type": "A6", + "format": "uint32", + "iid": 9 + } + ], + "iid": 1 + }, + { + "type": "A2", + "characteristics": [ + { + "value": "1.1.0", + "perms": [ + "pr" + ], + "maxLen": 64, + "type": "37", + "format": "string", + "iid": 31 + } + ], + "iid": 30 + }, + { + "primary": true, + "type": "4A", + "characteristics": [ + { + "value": 1, + "maxValue": 2, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "F", + "minValue": 0, + "format": "uint8", + "iid": 17 + }, + { + "value": 1, + "maxValue": 3, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "33", + "minValue": 0, + "format": "uint8", + "iid": 18 + }, + { + "value": 21.8, + "maxValue": 100, + "minStep": 0.1, + "perms": [ + "pr", + "ev" + ], + "unit": "celsius", + "type": "11", + "minValue": 0, + "format": "float", + "iid": 19 + }, + { + "value": 22.2, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "35", + "minValue": 7.2, + "format": "float", + "iid": 20 + }, + { + "value": 1, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "36", + "minValue": 0, + "format": "uint8", + "iid": 21 + }, + { + "value": 24.4, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "D", + "minValue": 18.3, + "format": "float", + "iid": 22 + }, + { + "value": 22.2, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "12", + "minValue": 7.2, + "format": "float", + "iid": 23 + }, + { + "value": 34, + "maxValue": 100, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "unit": "percentage", + "type": "10", + "minValue": 0, + "format": "float", + "iid": 24 + }, + { + "value": 36, + "maxValue": 50, + "minStep": 1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "percentage", + "type": "34", + "minValue": 20, + "format": "float", + "iid": 25 + }, + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 27 + }, + { + "value": 0, + "perms": [ + "pr", + "ev" + ], + "type": "B7DDB9A3-54BB-4572-91D2-F1F5B0510F8C", + "format": "uint8", + "iid": 33 + }, + { + "value": 22.2, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "E4489BBC-5227-4569-93E5-B345E3E5508F", + "minValue": 7.2, + "format": "float", + "iid": 34 + }, + { + "value": 24.4, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "7D381BAA-20F9-40E5-9BE9-AEB92D4BECEF", + "minValue": 18.3, + "format": "float", + "iid": 35 + }, + { + "value": 17.8, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "73AAB542-892A-4439-879A-D2A883724B69", + "minValue": 7.2, + "format": "float", + "iid": 36 + }, + { + "value": 27.8, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "5DA985F0-898A-4850-B987-B76C6C78D670", + "minValue": 18.3, + "format": "float", + "iid": 37 + }, + { + "value": 18.9, + "maxValue": 26.1, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "05B97374-6DC0-439B-A0FA-CA33F612D425", + "minValue": 7.2, + "format": "float", + "iid": 38 + }, + { + "value": 26.7, + "maxValue": 33.3, + "minStep": 0.1, + "perms": [ + "pr", + "pw", + "ev" + ], + "unit": "celsius", + "type": "A251F6E7-AC46-4190-9C5D-3D06277BDF9F", + "minValue": 18.3, + "format": "float", + "iid": 39 + }, + { + "minValue": 0, + "maxValue": 3, + "minStep": 1, + "perms": [ + "pw" + ], + "type": "1B300BC2-CFFC-47FF-89F9-BD6CCF5F2853", + "format": "uint8", + "iid": 40 + }, + { + "value": "2014-01-03T00:00:00-05:00", + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "1621F556-1367-443C-AF19-82AF018E99DE", + "format": "string", + "iid": 41 + }, + { + "perms": [ + "pw" + ], + "type": "FA128DE6-9D7D-49A4-B6D8-4E4E234DEE38", + "format": "bool", + "iid": 48 + }, + { + "value": 1, + "perms": [ + "pr", + "ev" + ], + "type": "4A6AE4F6-036C-495D-87CC-B3702B437741", + "format": "uint8", + "iid": 49 + }, + { + "value": 0, + "perms": [ + "pr", + "ev" + ], + "type": "DB7BF261-7042-4194-8BD1-3AA22830AEDD", + "format": "uint8", + "iid": 50 + }, + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "41935E3E-B54D-42E9-B8B9-D33C6319F0AF", + "format": "bool", + "iid": 51 + }, + { + "minValue": 0, + "maxValue": 100, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "C35DA3C0-E004-40E3-B153-46655CDD9214", + "value": 0, + "format": "uint8", + "iid": 52 + }, + { + "value": 100, + "perms": [ + "pr", + "ev" + ], + "type": "48F62AEC-4171-4B4A-8F0E-1EEB6708B3FB", + "format": "uint8", + "iid": 53 + }, + { + "value": "The Hive is humming along. You have no pending alerts or reminders.", + "perms": [ + "pr", + "ev" + ], + "iid": 54, + "type": "1B1515F2-CC45-409F-991F-C480987F92C3", + "format": "string", + "maxLen": 256 + } + ], + "iid": 16 + }, + { + "type": "85", + "characteristics": [ + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 28 + }, + { + "value": false, + "perms": [ + "pr", + "ev" + ], + "type": "22", + "format": "bool", + "iid": 66 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "BFE61C70-4A40-11E6-BDF4-0800200C9A66", + "value": 2980, + "format": "int", + "iid": 67 + } + ], + "iid": 56 + }, + { + "type": "86", + "characteristics": [ + { + "value": "HomeW", + "perms": [ + "pr" + ], + "type": "23", + "format": "string", + "iid": 29 + }, + { + "minValue": 0, + "maxValue": 1, + "minStep": 1, + "perms": [ + "pr", + "ev" + ], + "type": "71", + "value": 1, + "format": "uint8", + "iid": 65 + }, + { + "minValue": -1, + "maxValue": 86400, + "perms": [ + "pr", + "ev" + ], + "type": "A8f798E0-4A40-11E6-BDF4-0800200C9A66", + "value": 2980, + "format": "int", + "iid": 68 + } + ], + "iid": 57 + } + ] + } +] \ No newline at end of file diff --git a/tests/components/homekit_controller/specific_devices/koogeek_ls1.json b/tests/fixtures/homekit_controller/koogeek_ls1.json similarity index 100% rename from tests/components/homekit_controller/specific_devices/koogeek_ls1.json rename to tests/fixtures/homekit_controller/koogeek_ls1.json diff --git a/tests/fixtures/homekit_controller/lennox_e30.json b/tests/fixtures/homekit_controller/lennox_e30.json new file mode 100644 index 00000000000..9d2fe115259 --- /dev/null +++ b/tests/fixtures/homekit_controller/lennox_e30.json @@ -0,0 +1,196 @@ +[ + { + "aid": 1, + "services": [ + { + "characteristics": [ + { + "format": "bool", + "iid": 2, + "perms": [ + "pw" + ], + "type": "14" + }, + { + "format": "string", + "iid": 3, + "perms": [ + "pr" + ], + "type": "20", + "value": "Lennox" + }, + { + "format": "string", + "iid": 4, + "perms": [ + "pr" + ], + "type": "21", + "value": "E30 2B" + }, + { + "format": "string", + "iid": 5, + "perms": [ + "pr" + ], + "type": "23", + "value": "Lennox" + }, + { + "format": "string", + "iid": 6, + "perms": [ + "pr" + ], + "type": "30", + "value": "XXXXXXXX" + }, + { + "format": "string", + "iid": 7, + "perms": [ + "pr" + ], + "type": "52", + "value": "3.40.XX" + }, + { + "format": "string", + "iid": 8, + "perms": [ + "pr" + ], + "type": "53", + "value": "3.0.XX" + } + ], + "iid": 1, + "type": "3E" + }, + { + "characteristics": [ + { + "format": "uint8", + "iid": 101, + "maxValue": 2, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "F", + "value": 1 + }, + { + "format": "uint8", + "iid": 102, + "maxValue": 3, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "33", + "value": 3 + }, + { + "format": "float", + "iid": 103, + "maxValue": 100, + "minStep": 0.1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "11", + "unit": "celsius", + "value": 20.5 + }, + { + "format": "float", + "iid": 104, + "maxValue": 32, + "minStep": 0.5, + "minValue": 4.5, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "35", + "unit": "celsius", + "value": 21 + }, + { + "format": "uint8", + "iid": 105, + "maxValue": 1, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "36", + "value": 0 + }, + { + "format": "float", + "iid": 106, + "maxValue": 37, + "minStep": 0.5, + "minValue": 16, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "D", + "unit": "celsius", + "value": 29.5 + }, + { + "format": "float", + "iid": 107, + "maxValue": 100, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "10", + "unit": "percentage", + "value": 34 + }, + { + "format": "float", + "iid": 108, + "maxValue": 32, + "minStep": 0.5, + "minValue": 4.5, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "12", + "unit": "celsius", + "value": 21 + } + ], + "iid": 100, + "primary": true, + "type": "4A" + } + ] + } +] \ No newline at end of file