Add entity translations for homewizard (#95416)
* Add entity translations for homewizard * Add entity translations for homewizard * Add entity translations for homewizard * Fix tests
This commit is contained in:
parent
6c2c4c989f
commit
e9495c9cc6
5 changed files with 282 additions and 115 deletions
|
@ -29,7 +29,7 @@ class HWEnergyNumberEntity(HomeWizardEntity, NumberEntity):
|
|||
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_icon = "mdi:lightbulb-on"
|
||||
_attr_name = "Status light brightness"
|
||||
_attr_translation_key = "status_light_brightness"
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
|
||||
def __init__(
|
||||
|
@ -55,4 +55,5 @@ class HWEnergyNumberEntity(HomeWizardEntity, NumberEntity):
|
|||
or self.coordinator.data.state.brightness is None
|
||||
):
|
||||
return None
|
||||
return round(self.coordinator.data.state.brightness * (100 / 255))
|
||||
brightness: float = self.coordinator.data.state.brightness
|
||||
return round(brightness * (100 / 255))
|
||||
|
|
|
@ -54,7 +54,7 @@ class HomeWizardSensorEntityDescription(
|
|||
SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="smr_version",
|
||||
name="DSMR version",
|
||||
translation_key="dsmr_version",
|
||||
icon="mdi:counter",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.smr_version is not None,
|
||||
|
@ -62,7 +62,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="meter_model",
|
||||
name="Smart meter model",
|
||||
translation_key="meter_model",
|
||||
icon="mdi:gauge",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.meter_model is not None,
|
||||
|
@ -70,7 +70,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="unique_meter_id",
|
||||
name="Smart meter identifier",
|
||||
translation_key="unique_meter_id",
|
||||
icon="mdi:alphabetical-variant",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.unique_meter_id is not None,
|
||||
|
@ -78,7 +78,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="wifi_ssid",
|
||||
name="Wi-Fi SSID",
|
||||
translation_key="wifi_ssid",
|
||||
icon="mdi:wifi",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.wifi_ssid is not None,
|
||||
|
@ -86,7 +86,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_tariff",
|
||||
name="Active tariff",
|
||||
translation_key="active_tariff",
|
||||
icon="mdi:calendar-clock",
|
||||
has_fn=lambda data: data.active_tariff is not None,
|
||||
value_fn=lambda data: (
|
||||
|
@ -97,7 +97,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="wifi_strength",
|
||||
name="Wi-Fi strength",
|
||||
translation_key="wifi_strength",
|
||||
icon="mdi:wifi",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -108,7 +108,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_kwh",
|
||||
name="Total power import",
|
||||
translation_key="total_power_import_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -117,7 +117,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t1_kwh",
|
||||
name="Total power import T1",
|
||||
translation_key="total_power_import_t1_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -126,7 +126,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t2_kwh",
|
||||
name="Total power import T2",
|
||||
translation_key="total_power_import_t2_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -135,7 +135,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t3_kwh",
|
||||
name="Total power import T3",
|
||||
translation_key="total_power_import_t3_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -144,7 +144,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t4_kwh",
|
||||
name="Total power import T4",
|
||||
translation_key="total_power_import_t4_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -153,7 +153,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_kwh",
|
||||
name="Total power export",
|
||||
translation_key="total_power_export_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -163,7 +163,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t1_kwh",
|
||||
name="Total power export T1",
|
||||
translation_key="total_power_export_t1_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -173,7 +173,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t2_kwh",
|
||||
name="Total power export T2",
|
||||
translation_key="total_power_export_t2_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -183,7 +183,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t3_kwh",
|
||||
name="Total power export T3",
|
||||
translation_key="total_power_export_t3_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -193,7 +193,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t4_kwh",
|
||||
name="Total power export T4",
|
||||
translation_key="total_power_export_t4_kwh",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -203,7 +203,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_power_w",
|
||||
name="Active power",
|
||||
translation_key="active_power_w",
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -212,7 +212,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_power_l1_w",
|
||||
name="Active power L1",
|
||||
translation_key="active_power_l1_w",
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -221,7 +221,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_power_l2_w",
|
||||
name="Active power L2",
|
||||
translation_key="active_power_l2_w",
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -230,7 +230,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_power_l3_w",
|
||||
name="Active power L3",
|
||||
translation_key="active_power_l3_w",
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -239,7 +239,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_voltage_l1_v",
|
||||
name="Active voltage L1",
|
||||
translation_key="active_voltage_l1_v",
|
||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -249,7 +249,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_voltage_l2_v",
|
||||
name="Active voltage L2",
|
||||
translation_key="active_voltage_l2_v",
|
||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -259,7 +259,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_voltage_l3_v",
|
||||
name="Active voltage L3",
|
||||
translation_key="active_voltage_l3_v",
|
||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||
device_class=SensorDeviceClass.VOLTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -269,7 +269,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_current_l1_a",
|
||||
name="Active current L1",
|
||||
translation_key="active_current_l1_a",
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -279,7 +279,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_current_l2_a",
|
||||
name="Active current L2",
|
||||
translation_key="active_current_l2_a",
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -289,7 +289,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_current_l3_a",
|
||||
name="Active current L3",
|
||||
translation_key="active_current_l3_a",
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -299,7 +299,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_frequency_hz",
|
||||
name="Active frequency",
|
||||
translation_key="active_frequency_hz",
|
||||
native_unit_of_measurement=UnitOfFrequency.HERTZ,
|
||||
device_class=SensorDeviceClass.FREQUENCY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -309,7 +309,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="voltage_sag_l1_count",
|
||||
name="Voltage sags detected L1",
|
||||
translation_key="voltage_sag_l1_count",
|
||||
icon="mdi:alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.voltage_sag_l1_count is not None,
|
||||
|
@ -317,7 +317,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="voltage_sag_l2_count",
|
||||
name="Voltage sags detected L2",
|
||||
translation_key="voltage_sag_l2_count",
|
||||
icon="mdi:alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.voltage_sag_l2_count is not None,
|
||||
|
@ -325,7 +325,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="voltage_sag_l3_count",
|
||||
name="Voltage sags detected L3",
|
||||
translation_key="voltage_sag_l3_count",
|
||||
icon="mdi:alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.voltage_sag_l3_count is not None,
|
||||
|
@ -333,7 +333,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="voltage_swell_l1_count",
|
||||
name="Voltage swells detected L1",
|
||||
translation_key="voltage_swell_l1_count",
|
||||
icon="mdi:alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.voltage_swell_l1_count is not None,
|
||||
|
@ -341,7 +341,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="voltage_swell_l2_count",
|
||||
name="Voltage swells detected L2",
|
||||
translation_key="voltage_swell_l2_count",
|
||||
icon="mdi:alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.voltage_swell_l2_count is not None,
|
||||
|
@ -349,7 +349,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="voltage_swell_l3_count",
|
||||
name="Voltage swells detected L3",
|
||||
translation_key="voltage_swell_l3_count",
|
||||
icon="mdi:alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.voltage_swell_l3_count is not None,
|
||||
|
@ -357,7 +357,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="any_power_fail_count",
|
||||
name="Power failures detected",
|
||||
translation_key="any_power_fail_count",
|
||||
icon="mdi:transmission-tower-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.any_power_fail_count is not None,
|
||||
|
@ -365,7 +365,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="long_power_fail_count",
|
||||
name="Long power failures detected",
|
||||
translation_key="long_power_fail_count",
|
||||
icon="mdi:transmission-tower-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.long_power_fail_count is not None,
|
||||
|
@ -373,7 +373,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_power_average_w",
|
||||
name="Active average demand",
|
||||
translation_key="active_power_average_w",
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
has_fn=lambda data: data.active_power_average_w is not None,
|
||||
|
@ -381,7 +381,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="monthly_power_peak_w",
|
||||
name="Peak demand current month",
|
||||
translation_key="monthly_power_peak_w",
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
has_fn=lambda data: data.monthly_power_peak_w is not None,
|
||||
|
@ -389,7 +389,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_gas_m3",
|
||||
name="Total gas",
|
||||
translation_key="total_gas_m3",
|
||||
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||
device_class=SensorDeviceClass.GAS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
|
@ -398,7 +398,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="gas_unique_id",
|
||||
name="Gas meter identifier",
|
||||
translation_key="gas_unique_id",
|
||||
icon="mdi:alphabetical-variant",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
has_fn=lambda data: data.gas_unique_id is not None,
|
||||
|
@ -406,7 +406,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_liter_lpm",
|
||||
name="Active water usage",
|
||||
translation_key="active_liter_lpm",
|
||||
native_unit_of_measurement="l/min",
|
||||
icon="mdi:water",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -415,7 +415,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
|||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_liter_m3",
|
||||
name="Total water usage",
|
||||
translation_key="total_liter_m3",
|
||||
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||
icon="mdi:gauge",
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
|
|
|
@ -27,5 +27,145 @@
|
|||
"unknown_error": "[%key:common::config_flow::error::unknown%]",
|
||||
"reauth_successful": "Enabling API was successful"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"number": {
|
||||
"status_light_brightness": {
|
||||
"name": "Status light brightness"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"dsmr_version": {
|
||||
"name": "DSMR version"
|
||||
},
|
||||
"meter_model": {
|
||||
"name": "Smart meter model"
|
||||
},
|
||||
"unique_meter_id": {
|
||||
"name": "Smart meter identifier"
|
||||
},
|
||||
"wifi_ssid": {
|
||||
"name": "Wi-Fi SSID"
|
||||
},
|
||||
"active_tariff": {
|
||||
"name": "Active tariff"
|
||||
},
|
||||
"wifi_strength": {
|
||||
"name": "Wi-Fi strength"
|
||||
},
|
||||
"total_power_import_kwh": {
|
||||
"name": "Total power import"
|
||||
},
|
||||
"total_power_import_t1_kwh": {
|
||||
"name": "Total power import tariff 1"
|
||||
},
|
||||
"total_power_import_t2_kwh": {
|
||||
"name": "Total power import tariff 2"
|
||||
},
|
||||
"total_power_import_t3_kwh": {
|
||||
"name": "Total power import tariff 3"
|
||||
},
|
||||
"total_power_import_t4_kwh": {
|
||||
"name": "Total power import tariff 4"
|
||||
},
|
||||
"total_power_export_kwh": {
|
||||
"name": "Total power export"
|
||||
},
|
||||
"total_power_export_t1_kwh": {
|
||||
"name": "Total power export tariff 1"
|
||||
},
|
||||
"total_power_export_t2_kwh": {
|
||||
"name": "Total power export tariff 2"
|
||||
},
|
||||
"total_power_export_t3_kwh": {
|
||||
"name": "Total power export tariff 3"
|
||||
},
|
||||
"total_power_export_t4_kwh": {
|
||||
"name": "Total power export tariff 4"
|
||||
},
|
||||
"active_power_w": {
|
||||
"name": "Active power"
|
||||
},
|
||||
"active_power_l1_w": {
|
||||
"name": "Active power phase 1"
|
||||
},
|
||||
"active_power_l2_w": {
|
||||
"name": "Active power phase 2"
|
||||
},
|
||||
"active_power_l3_w": {
|
||||
"name": "Active power phase 3"
|
||||
},
|
||||
"active_voltage_l1_v": {
|
||||
"name": "Active voltage phase 1"
|
||||
},
|
||||
"active_voltage_l2_v": {
|
||||
"name": "Active voltage phase 2"
|
||||
},
|
||||
"active_voltage_l3_v": {
|
||||
"name": "Active voltage phase 3"
|
||||
},
|
||||
"active_current_l1_a": {
|
||||
"name": "Active current phase 1"
|
||||
},
|
||||
"active_current_l2_a": {
|
||||
"name": "Active current phase 2"
|
||||
},
|
||||
"active_current_l3_a": {
|
||||
"name": "Active current phase 3"
|
||||
},
|
||||
"active_frequency_hz": {
|
||||
"name": "Active frequency"
|
||||
},
|
||||
"voltage_sag_l1_count": {
|
||||
"name": "Voltage sags detected phase 1"
|
||||
},
|
||||
"voltage_sag_l2_count": {
|
||||
"name": "Voltage sags detected phase 2"
|
||||
},
|
||||
"voltage_sag_l3_count": {
|
||||
"name": "Voltage sags detected phase 3"
|
||||
},
|
||||
"voltage_swell_l1_count": {
|
||||
"name": "Voltage swells detected phase 1"
|
||||
},
|
||||
"voltage_swell_l2_count": {
|
||||
"name": "Voltage swells detected phase 2"
|
||||
},
|
||||
"voltage_swell_l3_count": {
|
||||
"name": "Voltage swells detected phase 3"
|
||||
},
|
||||
"any_power_fail_count": {
|
||||
"name": "Power failures detected"
|
||||
},
|
||||
"long_power_fail_count": {
|
||||
"name": "Long power failures detected"
|
||||
},
|
||||
"active_power_average_w": {
|
||||
"name": "Active average demand"
|
||||
},
|
||||
"monthly_power_peak_w": {
|
||||
"name": "Peak demand current month"
|
||||
},
|
||||
"total_gas_m3": {
|
||||
"name": "Total gas"
|
||||
},
|
||||
"gas_unique_id": {
|
||||
"name": "Gas meter identifier"
|
||||
},
|
||||
"active_liter_lpm": {
|
||||
"name": "Active water usage"
|
||||
},
|
||||
"total_liter_m3": {
|
||||
"name": "Total water usage"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"switch_lock": {
|
||||
"name": "Switch lock"
|
||||
},
|
||||
"cloud_connection": {
|
||||
"name": "Cloud connection"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ SWITCHES = [
|
|||
),
|
||||
HomeWizardSwitchEntityDescription(
|
||||
key="switch_lock",
|
||||
name="Switch lock",
|
||||
translation_key="switch_lock",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
icon="mdi:lock",
|
||||
icon_off="mdi:lock-open",
|
||||
|
@ -64,7 +64,7 @@ SWITCHES = [
|
|||
),
|
||||
HomeWizardSwitchEntityDescription(
|
||||
key="cloud_connection",
|
||||
name="Cloud connection",
|
||||
translation_key="cloud_connection",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
icon="mdi:cloud",
|
||||
icon_off="mdi:cloud-off-outline",
|
||||
|
|
|
@ -254,7 +254,7 @@ async def test_sensor_entity_wifi_strength(
|
|||
assert entry.disabled
|
||||
|
||||
|
||||
async def test_sensor_entity_total_power_import_t1_kwh(
|
||||
async def test_sensor_entity_total_power_import_tariff_1_kwh(
|
||||
hass: HomeAssistant, mock_config_entry_data, mock_config_entry
|
||||
) -> None:
|
||||
"""Test entity loads total power import t1."""
|
||||
|
@ -277,9 +277,11 @@ async def test_sensor_entity_total_power_import_t1_kwh(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_total_power_import_t1")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -288,7 +290,7 @@ async def test_sensor_entity_total_power_import_t1_kwh(
|
|||
assert state.state == "1234.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Total power import T1"
|
||||
== "Product Name (aabbccddeeff) Total power import tariff 1"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfEnergy.KILO_WATT_HOUR
|
||||
|
@ -296,7 +298,7 @@ async def test_sensor_entity_total_power_import_t1_kwh(
|
|||
assert ATTR_ICON not in state.attributes
|
||||
|
||||
|
||||
async def test_sensor_entity_total_power_import_t2_kwh(
|
||||
async def test_sensor_entity_total_power_import_tariff_2_kwh(
|
||||
hass: HomeAssistant, mock_config_entry_data, mock_config_entry
|
||||
) -> None:
|
||||
"""Test entity loads total power import t2."""
|
||||
|
@ -319,9 +321,11 @@ async def test_sensor_entity_total_power_import_t2_kwh(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_total_power_import_t2")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_2"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t2"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_2"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -330,7 +334,7 @@ async def test_sensor_entity_total_power_import_t2_kwh(
|
|||
assert state.state == "1234.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Total power import T2"
|
||||
== "Product Name (aabbccddeeff) Total power import tariff 2"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfEnergy.KILO_WATT_HOUR
|
||||
|
@ -338,7 +342,7 @@ async def test_sensor_entity_total_power_import_t2_kwh(
|
|||
assert ATTR_ICON not in state.attributes
|
||||
|
||||
|
||||
async def test_sensor_entity_total_power_export_t1_kwh(
|
||||
async def test_sensor_entity_total_power_export_tariff_1_kwh(
|
||||
hass: HomeAssistant, mock_config_entry_data, mock_config_entry
|
||||
) -> None:
|
||||
"""Test entity loads total power export t1."""
|
||||
|
@ -361,9 +365,11 @@ async def test_sensor_entity_total_power_export_t1_kwh(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_total_power_export_t1")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_tariff_1"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_tariff_1"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -372,7 +378,7 @@ async def test_sensor_entity_total_power_export_t1_kwh(
|
|||
assert state.state == "1234.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Total power export T1"
|
||||
== "Product Name (aabbccddeeff) Total power export tariff 1"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfEnergy.KILO_WATT_HOUR
|
||||
|
@ -380,7 +386,7 @@ async def test_sensor_entity_total_power_export_t1_kwh(
|
|||
assert ATTR_ICON not in state.attributes
|
||||
|
||||
|
||||
async def test_sensor_entity_total_power_export_t2_kwh(
|
||||
async def test_sensor_entity_total_power_export_tariff_2_kwh(
|
||||
hass: HomeAssistant, mock_config_entry_data, mock_config_entry
|
||||
) -> None:
|
||||
"""Test entity loads total power export t2."""
|
||||
|
@ -403,9 +409,11 @@ async def test_sensor_entity_total_power_export_t2_kwh(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_total_power_export_t2")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_tariff_2"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_t2"
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_tariff_2"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -414,7 +422,7 @@ async def test_sensor_entity_total_power_export_t2_kwh(
|
|||
assert state.state == "1234.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Total power export T2"
|
||||
== "Product Name (aabbccddeeff) Total power export tariff 2"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfEnergy.KILO_WATT_HOUR
|
||||
|
@ -481,9 +489,9 @@ async def test_sensor_entity_active_power_l1(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_power_l1")
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_power_phase_1")
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_power_l1"
|
||||
"sensor.product_name_aabbccddeeff_active_power_phase_1"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -492,7 +500,7 @@ async def test_sensor_entity_active_power_l1(
|
|||
assert state.state == "123.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active power L1"
|
||||
== "Product Name (aabbccddeeff) Active power phase 1"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.WATT
|
||||
|
@ -521,9 +529,9 @@ async def test_sensor_entity_active_power_l2(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_power_l2")
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_power_phase_2")
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_power_l2"
|
||||
"sensor.product_name_aabbccddeeff_active_power_phase_2"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -532,7 +540,7 @@ async def test_sensor_entity_active_power_l2(
|
|||
assert state.state == "456.456"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active power L2"
|
||||
== "Product Name (aabbccddeeff) Active power phase 2"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.WATT
|
||||
|
@ -561,9 +569,9 @@ async def test_sensor_entity_active_power_l3(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_power_l3")
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_power_phase_3")
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_power_l3"
|
||||
"sensor.product_name_aabbccddeeff_active_power_phase_3"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -572,7 +580,7 @@ async def test_sensor_entity_active_power_l3(
|
|||
assert state.state == "789.789"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active power L3"
|
||||
== "Product Name (aabbccddeeff) Active power phase 3"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPower.WATT
|
||||
|
@ -680,7 +688,7 @@ async def test_sensor_entity_active_voltage_l1(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
disabled_entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_l1"
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_phase_1"
|
||||
)
|
||||
assert disabled_entry
|
||||
assert disabled_entry.disabled
|
||||
|
@ -701,12 +709,14 @@ async def test_sensor_entity_active_voltage_l1(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_voltage_l1")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_phase_1"
|
||||
)
|
||||
assert state
|
||||
assert state.state == "230.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active voltage L1"
|
||||
== "Product Name (aabbccddeeff) Active voltage phase 1"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -739,7 +749,7 @@ async def test_sensor_entity_active_voltage_l2(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
disabled_entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_l2"
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_phase_2"
|
||||
)
|
||||
assert disabled_entry
|
||||
assert disabled_entry.disabled
|
||||
|
@ -760,12 +770,14 @@ async def test_sensor_entity_active_voltage_l2(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_voltage_l2")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_phase_2"
|
||||
)
|
||||
assert state
|
||||
assert state.state == "230.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active voltage L2"
|
||||
== "Product Name (aabbccddeeff) Active voltage phase 2"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -798,7 +810,7 @@ async def test_sensor_entity_active_voltage_l3(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
disabled_entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_l3"
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_phase_3"
|
||||
)
|
||||
assert disabled_entry
|
||||
assert disabled_entry.disabled
|
||||
|
@ -819,12 +831,14 @@ async def test_sensor_entity_active_voltage_l3(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_voltage_l3")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_active_voltage_phase_3"
|
||||
)
|
||||
assert state
|
||||
assert state.state == "230.123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active voltage L3"
|
||||
== "Product Name (aabbccddeeff) Active voltage phase 3"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -857,7 +871,7 @@ async def test_sensor_entity_active_current_l1(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
disabled_entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_current_l1"
|
||||
"sensor.product_name_aabbccddeeff_active_current_phase_1"
|
||||
)
|
||||
assert disabled_entry
|
||||
assert disabled_entry.disabled
|
||||
|
@ -878,12 +892,14 @@ async def test_sensor_entity_active_current_l1(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_current_l1")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_active_current_phase_1"
|
||||
)
|
||||
assert state
|
||||
assert state.state == "12.34"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active current L1"
|
||||
== "Product Name (aabbccddeeff) Active current phase 1"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -916,7 +932,7 @@ async def test_sensor_entity_active_current_l2(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
disabled_entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_current_l2"
|
||||
"sensor.product_name_aabbccddeeff_active_current_phase_2"
|
||||
)
|
||||
assert disabled_entry
|
||||
assert disabled_entry.disabled
|
||||
|
@ -937,12 +953,14 @@ async def test_sensor_entity_active_current_l2(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_current_l2")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_active_current_phase_2"
|
||||
)
|
||||
assert state
|
||||
assert state.state == "12.34"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active current L2"
|
||||
== "Product Name (aabbccddeeff) Active current phase 2"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -975,7 +993,7 @@ async def test_sensor_entity_active_current_l3(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
disabled_entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_current_l3"
|
||||
"sensor.product_name_aabbccddeeff_active_current_phase_3"
|
||||
)
|
||||
assert disabled_entry
|
||||
assert disabled_entry.disabled
|
||||
|
@ -996,12 +1014,14 @@ async def test_sensor_entity_active_current_l3(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_active_current_l3")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_active_current_phase_3"
|
||||
)
|
||||
assert state
|
||||
assert state.state == "12.34"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Active current L3"
|
||||
== "Product Name (aabbccddeeff) Active current phase 3"
|
||||
)
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -1089,9 +1109,11 @@ async def test_sensor_entity_voltage_sag_count_l1(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_voltage_sags_detected_l1")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_phase_1"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_l1"
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_phase_1"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -1100,7 +1122,7 @@ async def test_sensor_entity_voltage_sag_count_l1(
|
|||
assert state.state == "123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Voltage sags detected L1"
|
||||
== "Product Name (aabbccddeeff) Voltage sags detected phase 1"
|
||||
)
|
||||
assert ATTR_STATE_CLASS not in state.attributes
|
||||
assert ATTR_UNIT_OF_MEASUREMENT not in state.attributes
|
||||
|
@ -1128,9 +1150,11 @@ async def test_sensor_entity_voltage_sag_count_l2(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_voltage_sags_detected_l2")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_phase_2"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_l2"
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_phase_2"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -1139,7 +1163,7 @@ async def test_sensor_entity_voltage_sag_count_l2(
|
|||
assert state.state == "123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Voltage sags detected L2"
|
||||
== "Product Name (aabbccddeeff) Voltage sags detected phase 2"
|
||||
)
|
||||
assert ATTR_STATE_CLASS not in state.attributes
|
||||
assert ATTR_UNIT_OF_MEASUREMENT not in state.attributes
|
||||
|
@ -1167,9 +1191,11 @@ async def test_sensor_entity_voltage_sag_count_l3(
|
|||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.product_name_aabbccddeeff_voltage_sags_detected_l3")
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_phase_3"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_l3"
|
||||
"sensor.product_name_aabbccddeeff_voltage_sags_detected_phase_3"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -1178,7 +1204,7 @@ async def test_sensor_entity_voltage_sag_count_l3(
|
|||
assert state.state == "123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Voltage sags detected L3"
|
||||
== "Product Name (aabbccddeeff) Voltage sags detected phase 3"
|
||||
)
|
||||
assert ATTR_STATE_CLASS not in state.attributes
|
||||
assert ATTR_UNIT_OF_MEASUREMENT not in state.attributes
|
||||
|
@ -1207,10 +1233,10 @@ async def test_sensor_entity_voltage_swell_count_l1(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_l1"
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_phase_1"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_l1"
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_phase_1"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -1219,7 +1245,7 @@ async def test_sensor_entity_voltage_swell_count_l1(
|
|||
assert state.state == "123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Voltage swells detected L1"
|
||||
== "Product Name (aabbccddeeff) Voltage swells detected phase 1"
|
||||
)
|
||||
assert ATTR_STATE_CLASS not in state.attributes
|
||||
assert ATTR_UNIT_OF_MEASUREMENT not in state.attributes
|
||||
|
@ -1248,10 +1274,10 @@ async def test_sensor_entity_voltage_swell_count_l2(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_l2"
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_phase_2"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_l2"
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_phase_2"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -1260,7 +1286,7 @@ async def test_sensor_entity_voltage_swell_count_l2(
|
|||
assert state.state == "123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Voltage swells detected L2"
|
||||
== "Product Name (aabbccddeeff) Voltage swells detected phase 2"
|
||||
)
|
||||
assert ATTR_STATE_CLASS not in state.attributes
|
||||
assert ATTR_UNIT_OF_MEASUREMENT not in state.attributes
|
||||
|
@ -1289,10 +1315,10 @@ async def test_sensor_entity_voltage_swell_count_l3(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_l3"
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_phase_3"
|
||||
)
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_l3"
|
||||
"sensor.product_name_aabbccddeeff_voltage_swells_detected_phase_3"
|
||||
)
|
||||
assert entry
|
||||
assert state
|
||||
|
@ -1301,7 +1327,7 @@ async def test_sensor_entity_voltage_swell_count_l3(
|
|||
assert state.state == "123"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Product Name (aabbccddeeff) Voltage swells detected L3"
|
||||
== "Product Name (aabbccddeeff) Voltage swells detected phase 3"
|
||||
)
|
||||
assert ATTR_STATE_CLASS not in state.attributes
|
||||
assert ATTR_UNIT_OF_MEASUREMENT not in state.attributes
|
||||
|
@ -1582,12 +1608,12 @@ async def test_sensor_entity_disabled_when_null(
|
|||
entity_registry = er.async_get(hass)
|
||||
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_power_l2"
|
||||
"sensor.product_name_aabbccddeeff_active_power_phase_2"
|
||||
)
|
||||
assert entry is None
|
||||
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_active_power_l3"
|
||||
"sensor.product_name_aabbccddeeff_active_power_phase_3"
|
||||
)
|
||||
assert entry is None
|
||||
|
||||
|
@ -1633,13 +1659,13 @@ async def test_sensor_entity_export_disabled_when_unused(
|
|||
assert entry.disabled
|
||||
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_tariff_1"
|
||||
)
|
||||
assert entry
|
||||
assert entry.disabled
|
||||
|
||||
entry = entity_registry.async_get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_t2"
|
||||
"sensor.product_name_aabbccddeeff_total_power_export_tariff_2"
|
||||
)
|
||||
assert entry
|
||||
assert entry.disabled
|
||||
|
@ -1669,7 +1695,7 @@ async def test_sensors_unreachable(
|
|||
|
||||
assert (
|
||||
hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
).state
|
||||
== "1234.123"
|
||||
)
|
||||
|
@ -1679,7 +1705,7 @@ async def test_sensors_unreachable(
|
|||
await hass.async_block_till_done()
|
||||
assert (
|
||||
hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
).state
|
||||
== "unavailable"
|
||||
)
|
||||
|
@ -1689,7 +1715,7 @@ async def test_sensors_unreachable(
|
|||
await hass.async_block_till_done()
|
||||
assert (
|
||||
hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
).state
|
||||
== "1234.123"
|
||||
)
|
||||
|
@ -1719,7 +1745,7 @@ async def test_api_disabled(
|
|||
|
||||
assert (
|
||||
hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
).state
|
||||
== "1234.123"
|
||||
)
|
||||
|
@ -1729,7 +1755,7 @@ async def test_api_disabled(
|
|||
await hass.async_block_till_done()
|
||||
assert (
|
||||
hass.states.get(
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_t1"
|
||||
"sensor.product_name_aabbccddeeff_total_power_import_tariff_1"
|
||||
).state
|
||||
== "unavailable"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue