diff --git a/homeassistant/components/homekit_controller/const.py b/homeassistant/components/homekit_controller/const.py index 5b4c87f53e4..9e2ac1ce75b 100644 --- a/homeassistant/components/homekit_controller/const.py +++ b/homeassistant/components/homekit_controller/const.py @@ -45,6 +45,8 @@ HOMEKIT_ACCESSORY_DISPATCH = { CHARACTERISTIC_PLATFORMS = { CharacteristicsTypes.Vendor.EVE_ENERGY_WATT: "sensor", + CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE: "sensor", + CharacteristicsTypes.Vendor.EVE_DEGREE_ELEVATION: "number", CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY: "sensor", CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2: "sensor", CharacteristicsTypes.Vendor.VOCOLINC_HUMIDIFIER_SPRAY_LEVEL: "number", diff --git a/homeassistant/components/homekit_controller/manifest.json b/homeassistant/components/homekit_controller/manifest.json index a4644d0e34a..442db645c1f 100644 --- a/homeassistant/components/homekit_controller/manifest.json +++ b/homeassistant/components/homekit_controller/manifest.json @@ -3,7 +3,7 @@ "name": "HomeKit Controller", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/homekit_controller", - "requirements": ["aiohomekit==0.6.0"], + "requirements": ["aiohomekit==0.6.2"], "zeroconf": ["_hap._tcp.local."], "after_dependencies": ["zeroconf"], "codeowners": ["@Jc2k", "@bdraco"], diff --git a/homeassistant/components/homekit_controller/number.py b/homeassistant/components/homekit_controller/number.py index 73d8cd6adbd..79130bfcef7 100644 --- a/homeassistant/components/homekit_controller/number.py +++ b/homeassistant/components/homekit_controller/number.py @@ -15,7 +15,11 @@ NUMBER_ENTITIES = { CharacteristicsTypes.Vendor.VOCOLINC_HUMIDIFIER_SPRAY_LEVEL: { "name": "Spray Quantity", "icon": "mdi:water", - } + }, + CharacteristicsTypes.Vendor.EVE_DEGREE_ELEVATION: { + "name": "Elevation", + "icon": "mdi:elevation-rise", + }, } diff --git a/homeassistant/components/homekit_controller/sensor.py b/homeassistant/components/homekit_controller/sensor.py index 91b62b0d572..2de80eefd7e 100644 --- a/homeassistant/components/homekit_controller/sensor.py +++ b/homeassistant/components/homekit_controller/sensor.py @@ -9,10 +9,12 @@ from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_POWER, + DEVICE_CLASS_PRESSURE, DEVICE_CLASS_TEMPERATURE, LIGHT_LUX, PERCENTAGE, POWER_WATT, + PRESSURE_HPA, TEMP_CELSIUS, ) from homeassistant.core import callback @@ -44,6 +46,12 @@ SIMPLE_SENSOR = { "state_class": STATE_CLASS_MEASUREMENT, "unit": POWER_WATT, }, + CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE: { + "name": "Air Pressure", + "device_class": DEVICE_CLASS_PRESSURE, + "state_class": STATE_CLASS_MEASUREMENT, + "unit": PRESSURE_HPA, + }, CharacteristicsTypes.get_uuid(CharacteristicsTypes.TEMPERATURE_CURRENT): { "name": "Current Temperature", "device_class": DEVICE_CLASS_TEMPERATURE, diff --git a/requirements_all.txt b/requirements_all.txt index 8768b8a0851..d6a496a8a0d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -179,7 +179,7 @@ aioguardian==1.0.8 aioharmony==0.2.7 # homeassistant.components.homekit_controller -aiohomekit==0.6.0 +aiohomekit==0.6.2 # homeassistant.components.emulated_hue # homeassistant.components.http diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8668422683c..d5ef06dac87 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -115,7 +115,7 @@ aioguardian==1.0.8 aioharmony==0.2.7 # homeassistant.components.homekit_controller -aiohomekit==0.6.0 +aiohomekit==0.6.2 # homeassistant.components.emulated_hue # homeassistant.components.http diff --git a/tests/components/homekit_controller/specific_devices/test_eve_degree.py b/tests/components/homekit_controller/specific_devices/test_eve_degree.py new file mode 100644 index 00000000000..e419b140e94 --- /dev/null +++ b/tests/components/homekit_controller/specific_devices/test_eve_degree.py @@ -0,0 +1,74 @@ +"""Make sure that Eve Degree (via Eve Extend) is enumerated properly.""" + +from homeassistant.helpers import device_registry as dr, entity_registry as er + +from tests.components.homekit_controller.common import ( + Helper, + setup_accessories_from_file, + setup_test_accessories, +) + + +async def test_eve_degree_setup(hass): + """Test that the accessory can be correctly setup in HA.""" + accessories = await setup_accessories_from_file(hass, "eve_degree.json") + config_entry, pairing = await setup_test_accessories(hass, accessories) + + entity_registry = er.async_get(hass) + device_registry = dr.async_get(hass) + + sensors = [ + ( + "sensor.eve_degree_aa11_temperature", + "homekit-AA00A0A00000-22", + "Eve Degree AA11 Temperature", + ), + ( + "sensor.eve_degree_aa11_humidity", + "homekit-AA00A0A00000-27", + "Eve Degree AA11 Humidity", + ), + ( + "sensor.eve_degree_aa11_air_pressure", + "homekit-AA00A0A00000-aid:1-sid:30-cid:32", + "Eve Degree AA11 - Air Pressure", + ), + ( + "sensor.eve_degree_aa11_battery", + "homekit-AA00A0A00000-17", + "Eve Degree AA11 Battery", + ), + ( + "number.eve_degree_aa11", + "homekit-AA00A0A00000-aid:1-sid:30-cid:33", + "Eve Degree AA11", + ), + ] + + device_ids = set() + + for (entity_id, unique_id, friendly_name) in sensors: + entry = entity_registry.async_get(entity_id) + assert entry.unique_id == unique_id + + helper = Helper( + hass, + entity_id, + pairing, + accessories[0], + config_entry, + ) + state = await helper.poll_and_get_state() + assert state.attributes["friendly_name"] == friendly_name + + device = device_registry.async_get(entry.device_id) + assert device.manufacturer == "Elgato" + assert device.name == "Eve Degree AA11" + assert device.model == "Eve Degree 00AAA0000" + assert device.sw_version == "1.2.8" + assert device.via_device_id is None + + device_ids.add(entry.device_id) + + # All entities should be part of same device + assert len(device_ids) == 1 diff --git a/tests/fixtures/homekit_controller/eve_degree.json b/tests/fixtures/homekit_controller/eve_degree.json new file mode 100644 index 00000000000..2a1217789c4 --- /dev/null +++ b/tests/fixtures/homekit_controller/eve_degree.json @@ -0,0 +1,382 @@ +[ + { + "aid": 1, + "services": [ + { + "characteristics": [ + { + "format": "string", + "iid": 2, + "perms": [ + "pr" + ], + "type": "00000023-0000-1000-8000-0026BB765291", + "value": "Eve Degree AA11" + }, + { + "format": "bool", + "iid": 3, + "perms": [ + "pw" + ], + "type": "00000014-0000-1000-8000-0026BB765291" + }, + { + "format": "string", + "iid": 4, + "perms": [ + "pr" + ], + "type": "00000020-0000-1000-8000-0026BB765291", + "value": "Elgato" + }, + { + "format": "string", + "iid": 5, + "perms": [ + "pr" + ], + "type": "00000021-0000-1000-8000-0026BB765291", + "value": "Eve Degree 00AAA0000" + }, + { + "format": "string", + "iid": 6, + "perms": [ + "pr" + ], + "type": "00000030-0000-1000-8000-0026BB765291", + "value": "AA00A0A00000" + }, + { + "format": "string", + "iid": 7, + "perms": [ + "pr" + ], + "type": "00000052-0000-1000-8000-0026BB765291", + "value": "1.2.8" + }, + { + "format": "string", + "iid": 8, + "perms": [ + "pr" + ], + "type": "00000053-0000-1000-8000-0026BB765291", + "value": "1.0.0" + } + ], + "iid": 1, + "type": "0000003E-0000-1000-8000-0026BB765291" + }, + { + "characteristics": [ + { + "format": "string", + "iid": 18, + "perms": [ + "pr" + ], + "type": "00000023-0000-1000-8000-0026BB765291", + "value": "Battery" + }, + { + "format": "uint8", + "iid": 19, + "maxValue": 100, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "00000068-0000-1000-8000-0026BB765291", + "unit": "percentage", + "value": 65 + }, + { + "format": "uint8", + "iid": 20, + "maxValue": 2, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "0000008F-0000-1000-8000-0026BB765291", + "value": 2 + }, + { + "format": "uint8", + "iid": 21, + "maxValue": 1, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "00000079-0000-1000-8000-0026BB765291", + "value": 0 + } + ], + "iid": 17, + "type": "00000096-0000-1000-8000-0026BB765291" + }, + { + "characteristics": [ + { + "format": "string", + "iid": 23, + "perms": [ + "pr" + ], + "type": "00000023-0000-1000-8000-0026BB765291", + "value": "Eve Degree" + }, + { + "format": "float", + "iid": 24, + "maxValue": 100, + "minStep": 0.1, + "minValue": -30, + "perms": [ + "pr", + "ev" + ], + "type": "00000011-0000-1000-8000-0026BB765291", + "unit": "celsius", + "value": 22.77191162109375 + }, + { + "format": "uint8", + "iid": 25, + "maxValue": 1, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "00000036-0000-1000-8000-0026BB765291", + "value": 0 + } + ], + "iid": 22, + "type": "0000008A-0000-1000-8000-0026BB765291", + "primary": true + }, + { + "characteristics": [ + { + "format": "string", + "iid": 28, + "perms": [ + "pr" + ], + "type": "00000023-0000-1000-8000-0026BB765291", + "value": "Eve Degree" + }, + { + "format": "float", + "iid": 29, + "maxValue": 100, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "00000010-0000-1000-8000-0026BB765291", + "unit": "percentage", + "value": 59.4818115234375 + } + ], + "iid": 27, + "type": "00000082-0000-1000-8000-0026BB765291" + }, + { + "characteristics": [ + { + "format": "string", + "iid": 31, + "perms": [ + "pr" + ], + "type": "00000023-0000-1000-8000-0026BB765291", + "value": "Eve Degree" + }, + { + "format": "float", + "iid": 32, + "maxValue": 1100, + "minStep": 1, + "minValue": 870, + "perms": [ + "pr" + ], + "type": "E863F10F-079E-48FF-8F27-9C2605A29F52", + "value": 1005.7000122070312 + }, + { + "format": "float", + "iid": 33, + "maxValue": 9000, + "minStep": 1, + "minValue": -450, + "perms": [ + "pr", + "pw", + "ev" + ], + "type": "E863F130-079E-48FF-8F27-9C2605A29F52", + "value": 0 + }, + { + "format": "uint8", + "iid": 34, + "maxValue": 4, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "ev" + ], + "type": "E863F135-079E-48FF-8F27-9C2605A29F52", + "value": 0 + } + ], + "iid": 30, + "type": "E863F00A-079E-48FF-8F27-9C2605A29F52" + }, + { + "characteristics": [ + { + "format": "string", + "iid": 36, + "perms": [ + "pr" + ], + "type": "00000023-0000-1000-8000-0026BB765291", + "value": "Logging" + }, + { + "format": "data", + "iid": 37, + "perms": [ + "pr", + "pw" + ], + "type": "E863F11E-079E-48FF-8F27-9C2605A29F52", + "value": "HwABDh4AeAQKAIDVzj5aDMB/" + }, + { + "format": "uint32", + "iid": 38, + "maxValue": 4294967295, + "minStep": 1, + "minValue": 0, + "perms": [ + "pr", + "pw" + ], + "type": "E863F112-079E-48FF-8F27-9C2605A29F52", + "value": 0 + }, + { + "format": "data", + "iid": 39, + "perms": [ + "pw" + ], + "type": "E863F11C-079E-48FF-8F27-9C2605A29F52" + }, + { + "format": "data", + "iid": 40, + "perms": [ + "pw" + ], + "type": "E863F121-079E-48FF-8F27-9C2605A29F52" + }, + { + "format": "data", + "iid": 41, + "perms": [ + "pr" + ], + "type": "E863F116-079E-48FF-8F27-9C2605A29F52", + "value": "/wkAAJEGAABnvbUmBQECAgIDAh4BJwEGAAAQuvIBAAEAAAABAA==" + }, + { + "format": "data", + "iid": 42, + "perms": [ + "pr" + ], + "type": "E863F117-079E-48FF-8F27-9C2605A29F52", + "value": "" + }, + { + "format": "tlv8", + "iid": 43, + "perms": [ + "pr" + ], + "type": "E863F131-079E-48FF-8F27-9C2605A29F52", + "value": "AAIeAAMCeAQEDFNVMTNHMUEwMDI4MAYCBgAHBLryAQALAgAABQEAAgTwKQAAXwQAAAAAGQIABRQBAw8EAAAAABoEAAAAACUE9griHtJHEAABQEJcLdwpUbihgRCESYX8bA7yLTF6IKhlxv5ohrqDkOEyRTNCM0VDNC1CNENCLTg0MjYtM0Q1QS0zMDJFNEIzRTZERDA=" + }, + { + "format": "tlv8", + "iid": 44, + "perms": [ + "pw" + ], + "type": "E863F11D-079E-48FF-8F27-9C2605A29F52" + } + ], + "iid": 35, + "type": "E863F007-079E-48FF-8F27-9C2605A29F52", + "hidden": true + }, + { + "characteristics": [ + { + "format": "string", + "iid": 100001, + "perms": [ + "pr" + ], + "type": "E863F155-079E-48FF-8F27-9C2605A29F52", + "value": "11:11:11:11:11:11" + }, + { + "format": "uint16", + "iid": 100002, + "perms": [ + "pr" + ], + "type": "E863F156-079E-48FF-8F27-9C2605A29F52", + "value": 10 + }, + { + "format": "uint8", + "iid": 100003, + "perms": [ + "pr", + "ev" + ], + "type": "E863F157-079E-48FF-8F27-9C2605A29F52", + "value": 1 + } + ], + "hidden": true, + "iid": 100000, + "type": "E863F00B-079E-48FF-8F27-9C2605A29F52" + } + ] + } +] \ No newline at end of file