mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Add additional energy sensors to Eve Energy (#64826)
This commit is contained in:
parent
c8a63d4ffc
commit
24ee4256b9
@ -18,6 +18,7 @@ from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
ELECTRIC_POTENTIAL_VOLT,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
@ -76,6 +77,27 @@ SIMPLE_SENSOR: dict[str, HomeKitSensorEntityDescription] = {
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.EVE_ENERGY_KW_HOUR: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.EVE_ENERGY_KW_HOUR,
|
||||
name="Energy kWh",
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.EVE_ENERGY_VOLTAGE: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.EVE_ENERGY_VOLTAGE,
|
||||
name="Volts",
|
||||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.EVE_ENERGY_AMPERE: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.EVE_ENERGY_AMPERE,
|
||||
name="Amps",
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY: HomeKitSensorEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY,
|
||||
name="Real Time Energy",
|
||||
|
299
tests/components/homekit_controller/fixtures/eve_energy.json
Normal file
299
tests/components/homekit_controller/fixtures/eve_energy.json
Normal file
@ -0,0 +1,299 @@
|
||||
[
|
||||
{
|
||||
"aid": 1,
|
||||
"services": [
|
||||
{
|
||||
"characteristics": [
|
||||
{
|
||||
"format": "string",
|
||||
"iid": 2,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "00000023-0000-1000-8000-0026BB765291",
|
||||
"value": "Eve Energy 50FF"
|
||||
},
|
||||
{
|
||||
"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 Energy 20EAO8601"
|
||||
},
|
||||
{
|
||||
"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.9"
|
||||
},
|
||||
{
|
||||
"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": "Logging"
|
||||
},
|
||||
{
|
||||
"format": "data",
|
||||
"iid": 19,
|
||||
"perms": [
|
||||
"pr",
|
||||
"pw"
|
||||
],
|
||||
"type": "E863F11E-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": "HwABDigAuAQKAGLrnNSTogf+"
|
||||
},
|
||||
{
|
||||
"format": "uint32",
|
||||
"iid": 20,
|
||||
"maxValue": 4294967295,
|
||||
"minStep": 1,
|
||||
"minValue": 0,
|
||||
"perms": [
|
||||
"pr",
|
||||
"pw"
|
||||
],
|
||||
"type": "E863F112-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"format": "data",
|
||||
"iid": 21,
|
||||
"perms": [
|
||||
"pw"
|
||||
],
|
||||
"type": "E863F11C-079E-48FF-8F27-9C2605A29F52"
|
||||
},
|
||||
{
|
||||
"format": "data",
|
||||
"iid": 22,
|
||||
"perms": [
|
||||
"pw"
|
||||
],
|
||||
"type": "E863F121-079E-48FF-8F27-9C2605A29F52"
|
||||
},
|
||||
{
|
||||
"format": "data",
|
||||
"iid": 23,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F116-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": "QFUeAAAAAAAAAAAABQsCDAINAgcCDgEkDQAQaCMBAAEAAAABAA=="
|
||||
},
|
||||
{
|
||||
"format": "data",
|
||||
"iid": 24,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F117-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": "EmojAQABAAAADwAAAAAAAAAA"
|
||||
},
|
||||
{
|
||||
"format": "tlv8",
|
||||
"iid": 25,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F131-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": "AAIoAAMCuAQEDEZWMzVHMUEwMjkyOAYCJA0HBGgjAQALAgAABQEAAgRoOQAAXwQAAAAAGQKWABQBAw8EAAAAAEUFBQAAAABGCQUAAAAOAABCBkQRBRQABQMAAAAAAAAAAAAAAABHEQVzG0Uc3xy4HXgAAAA8AAAASAYFAAAAAABKBgUAAAAAABoEAAAAAGABZNAEE7sdAJsEQFUeANIA"
|
||||
},
|
||||
{
|
||||
"format": "tlv8",
|
||||
"iid": 26,
|
||||
"perms": [
|
||||
"pw"
|
||||
],
|
||||
"type": "E863F11D-079E-48FF-8F27-9C2605A29F52"
|
||||
}
|
||||
],
|
||||
"iid": 17,
|
||||
"type": "E863F007-079E-48FF-8F27-9C2605A29F52",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"characteristics": [
|
||||
{
|
||||
"format": "string",
|
||||
"iid": 29,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "00000023-0000-1000-8000-0026BB765291",
|
||||
"value": "Eve Energy"
|
||||
},
|
||||
{
|
||||
"format": "bool",
|
||||
"iid": 30,
|
||||
"perms": [
|
||||
"pr",
|
||||
"pw",
|
||||
"ev"
|
||||
],
|
||||
"type": "00000025-0000-1000-8000-0026BB765291",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"format": "bool",
|
||||
"iid": 31,
|
||||
"perms": [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"type": "00000026-0000-1000-8000-0026BB765291",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"format": "float",
|
||||
"iid": 32,
|
||||
"maxValue": 380,
|
||||
"minStep": 0.1,
|
||||
"minValue": 0,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F10A-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 0.4000000059604645
|
||||
},
|
||||
{
|
||||
"format": "float",
|
||||
"iid": 33,
|
||||
"maxValue": 16,
|
||||
"minStep": 0.1,
|
||||
"minValue": 0,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F126-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"format": "float",
|
||||
"iid": 34,
|
||||
"maxValue": 5000,
|
||||
"minStep": 0.1,
|
||||
"minValue": 0,
|
||||
"perms": [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"type": "E863F10D-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"format": "float",
|
||||
"iid": 35,
|
||||
"minStep": 0.1,
|
||||
"minValue": 0,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F10C-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 0.28999999165534973
|
||||
},
|
||||
{
|
||||
"format": "uint8",
|
||||
"iid": 36,
|
||||
"maxValue": 1,
|
||||
"minStep": 1,
|
||||
"minValue": 0,
|
||||
"perms": [
|
||||
"pr",
|
||||
"pw",
|
||||
"ev"
|
||||
],
|
||||
"type": "000000A7-0000-1000-8000-0026BB765291",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"iid": 28,
|
||||
"type": "00000047-0000-1000-8000-0026BB765291",
|
||||
"primary": true
|
||||
},
|
||||
{
|
||||
"characteristics": [
|
||||
{
|
||||
"format": "string",
|
||||
"iid": 100001,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F155-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": "03:29:72:EF:97:2F"
|
||||
},
|
||||
{
|
||||
"format": "uint16",
|
||||
"iid": 100002,
|
||||
"perms": [
|
||||
"pr"
|
||||
],
|
||||
"type": "E863F156-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 7
|
||||
},
|
||||
{
|
||||
"format": "uint8",
|
||||
"iid": 100003,
|
||||
"perms": [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"type": "E863F157-079E-48FF-8F27-9C2605A29F52",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"hidden": true,
|
||||
"iid": 100000,
|
||||
"type": "E863F00B-079E-48FF-8F27-9C2605A29F52"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -0,0 +1,86 @@
|
||||
"""Make sure that Eve Degree (via Eve Extend) is enumerated properly."""
|
||||
|
||||
from homeassistant.components.sensor import SensorStateClass
|
||||
from homeassistant.const import (
|
||||
ELECTRIC_CURRENT_AMPERE,
|
||||
ELECTRIC_POTENTIAL_VOLT,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
POWER_WATT,
|
||||
)
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
|
||||
from tests.components.homekit_controller.common import (
|
||||
HUB_TEST_ACCESSORY_ID,
|
||||
DeviceTestInfo,
|
||||
EntityTestInfo,
|
||||
assert_devices_and_entities_created,
|
||||
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_energy.json")
|
||||
await setup_test_accessories(hass, accessories)
|
||||
|
||||
await assert_devices_and_entities_created(
|
||||
hass,
|
||||
DeviceTestInfo(
|
||||
unique_id=HUB_TEST_ACCESSORY_ID,
|
||||
name="Eve Energy 50FF",
|
||||
model="Eve Energy 20EAO8601",
|
||||
manufacturer="Elgato",
|
||||
sw_version="1.2.9",
|
||||
hw_version="1.0.0",
|
||||
serial_number="AA00A0A00000",
|
||||
devices=[],
|
||||
entities=[
|
||||
EntityTestInfo(
|
||||
entity_id="switch.eve_energy_50ff",
|
||||
unique_id="homekit-AA00A0A00000-28",
|
||||
friendly_name="Eve Energy 50FF",
|
||||
state="off",
|
||||
),
|
||||
EntityTestInfo(
|
||||
entity_id="sensor.eve_energy_50ff_amps",
|
||||
unique_id="homekit-AA00A0A00000-aid:1-sid:28-cid:33",
|
||||
friendly_name="Eve Energy 50FF Amps",
|
||||
unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||
state="0",
|
||||
),
|
||||
EntityTestInfo(
|
||||
entity_id="sensor.eve_energy_50ff_volts",
|
||||
unique_id="homekit-AA00A0A00000-aid:1-sid:28-cid:32",
|
||||
friendly_name="Eve Energy 50FF Volts",
|
||||
unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||
state="0.400000005960464",
|
||||
),
|
||||
EntityTestInfo(
|
||||
entity_id="sensor.eve_energy_50ff_real_time_energy",
|
||||
unique_id="homekit-AA00A0A00000-aid:1-sid:28-cid:34",
|
||||
friendly_name="Eve Energy 50FF Real Time Energy",
|
||||
unit_of_measurement=POWER_WATT,
|
||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||
state="0",
|
||||
),
|
||||
EntityTestInfo(
|
||||
entity_id="sensor.eve_energy_50ff_energy_kwh",
|
||||
unique_id="homekit-AA00A0A00000-aid:1-sid:28-cid:35",
|
||||
friendly_name="Eve Energy 50FF Energy kWh",
|
||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
state="0.28999999165535",
|
||||
),
|
||||
EntityTestInfo(
|
||||
entity_id="button.eve_energy_50ff_identify",
|
||||
unique_id="homekit-AA00A0A00000-aid:1-sid:1-cid:3",
|
||||
friendly_name="Eve Energy 50FF Identify",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state="unknown",
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user