From edaee89e3484f30143056347af3262e4d8fe24dd Mon Sep 17 00:00:00 2001 From: Matthias Alphart <farmio@alphart.net> Date: Mon, 3 Apr 2023 20:05:52 +0200 Subject: [PATCH] Use entity name translations in Fronius (#90463) --- homeassistant/components/fronius/sensor.py | 77 +---- homeassistant/components/fronius/strings.json | 214 +++++++++++++ tests/components/fronius/test_sensor.py | 280 +++++++++--------- 3 files changed, 355 insertions(+), 216 deletions(-) diff --git a/homeassistant/components/fronius/sensor.py b/homeassistant/components/fronius/sensor.py index e7f93895370..4e706db032f 100644 --- a/homeassistant/components/fronius/sensor.py +++ b/homeassistant/components/fronius/sensor.py @@ -89,28 +89,24 @@ class FroniusSensorEntityDescription(SensorEntityDescription): INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ FroniusSensorEntityDescription( key="energy_day", - name="Energy day", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), FroniusSensorEntityDescription( key="energy_year", - name="Energy year", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), FroniusSensorEntityDescription( key="energy_total", - name="Energy total", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), FroniusSensorEntityDescription( key="frequency_ac", - name="Frequency AC", default_value=0, native_unit_of_measurement=UnitOfFrequency.HERTZ, device_class=SensorDeviceClass.FREQUENCY, @@ -119,7 +115,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="current_ac", - name="Current AC", default_value=0, native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, @@ -127,7 +122,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="current_dc", - name="Current DC", default_value=0, native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, @@ -136,7 +130,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="current_dc_2", - name="Current DC 2", default_value=0, native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, @@ -145,7 +138,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_ac", - name="Power AC", default_value=0, native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, @@ -153,7 +145,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_ac", - name="Voltage AC", default_value=0, native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, @@ -162,7 +153,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_dc", - name="Voltage DC", default_value=0, native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, @@ -171,7 +161,6 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_dc_2", - name="Voltage DC 2", default_value=0, native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, @@ -181,28 +170,23 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ # device status entities FroniusSensorEntityDescription( key="inverter_state", - name="Inverter state", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="error_code", - name="Error code", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="status_code", - name="Status code", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="led_state", - name="LED state", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="led_color", - name="LED color", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), @@ -211,19 +195,16 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ LOGGER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ FroniusSensorEntityDescription( key="co2_factor", - name="COâ‚‚ factor", state_class=SensorStateClass.MEASUREMENT, icon="mdi:molecule-co2", ), FroniusSensorEntityDescription( key="cash_factor", - name="Grid export tariff", state_class=SensorStateClass.MEASUREMENT, icon="mdi:cash-plus", ), FroniusSensorEntityDescription( key="delivery_factor", - name="Grid import tariff", state_class=SensorStateClass.MEASUREMENT, icon="mdi:cash-minus", ), @@ -232,7 +213,6 @@ LOGGER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ FroniusSensorEntityDescription( key="current_ac_phase_1", - name="Current AC phase 1", native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, @@ -240,7 +220,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="current_ac_phase_2", - name="Current AC phase 2", native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, @@ -248,7 +227,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="current_ac_phase_3", - name="Current AC phase 3", native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, @@ -256,7 +234,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_reactive_ac_consumed", - name="Energy reactive AC consumed", native_unit_of_measurement=ENERGY_VOLT_AMPERE_REACTIVE_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, icon="mdi:lightning-bolt-outline", @@ -264,7 +241,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_reactive_ac_produced", - name="Energy reactive AC produced", native_unit_of_measurement=ENERGY_VOLT_AMPERE_REACTIVE_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, icon="mdi:lightning-bolt-outline", @@ -272,7 +248,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_real_ac_minus", - name="Energy real AC minus", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, @@ -280,7 +255,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_real_ac_plus", - name="Energy real AC plus", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, @@ -288,33 +262,28 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_real_consumed", - name="Energy real consumed", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), FroniusSensorEntityDescription( key="energy_real_produced", - name="Energy real produced", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), FroniusSensorEntityDescription( key="frequency_phase_average", - name="Frequency phase average", native_unit_of_measurement=UnitOfFrequency.HERTZ, device_class=SensorDeviceClass.FREQUENCY, state_class=SensorStateClass.MEASUREMENT, ), FroniusSensorEntityDescription( key="meter_location", - name="Meter location", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="power_apparent_phase_1", - name="Power apparent phase 1", native_unit_of_measurement=UnitOfApparentPower.VOLT_AMPERE, device_class=SensorDeviceClass.APPARENT_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -323,7 +292,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_apparent_phase_2", - name="Power apparent phase 2", native_unit_of_measurement=UnitOfApparentPower.VOLT_AMPERE, device_class=SensorDeviceClass.APPARENT_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -332,7 +300,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_apparent_phase_3", - name="Power apparent phase 3", native_unit_of_measurement=UnitOfApparentPower.VOLT_AMPERE, device_class=SensorDeviceClass.APPARENT_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -341,7 +308,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_apparent", - name="Power apparent", native_unit_of_measurement=UnitOfApparentPower.VOLT_AMPERE, device_class=SensorDeviceClass.APPARENT_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -350,34 +316,29 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_factor_phase_1", - name="Power factor phase 1", device_class=SensorDeviceClass.POWER_FACTOR, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="power_factor_phase_2", - name="Power factor phase 2", device_class=SensorDeviceClass.POWER_FACTOR, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="power_factor_phase_3", - name="Power factor phase 3", device_class=SensorDeviceClass.POWER_FACTOR, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="power_factor", - name="Power factor", device_class=SensorDeviceClass.POWER_FACTOR, state_class=SensorStateClass.MEASUREMENT, ), FroniusSensorEntityDescription( key="power_reactive_phase_1", - name="Power reactive phase 1", native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -386,7 +347,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_reactive_phase_2", - name="Power reactive phase 2", native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -395,7 +355,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_reactive_phase_3", - name="Power reactive phase 3", native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -404,7 +363,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_reactive", - name="Power reactive", native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, @@ -413,7 +371,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_real_phase_1", - name="Power real phase 1", native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, @@ -421,7 +378,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_real_phase_2", - name="Power real phase 2", native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, @@ -429,7 +385,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_real_phase_3", - name="Power real phase 3", native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, @@ -437,14 +392,12 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_real", - name="Power real", native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, ), FroniusSensorEntityDescription( key="voltage_ac_phase_1", - name="Voltage AC phase 1", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -452,7 +405,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_ac_phase_2", - name="Voltage AC phase 2", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -460,7 +412,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_ac_phase_3", - name="Voltage AC phase 3", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -468,7 +419,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_ac_phase_to_phase_12", - name="Voltage AC phase 1-2", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -476,7 +426,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_ac_phase_to_phase_23", - name="Voltage AC phase 2-3", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -484,7 +433,6 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_ac_phase_to_phase_31", - name="Voltage AC phase 3-1", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -495,38 +443,32 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ OHMPILOT_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ FroniusSensorEntityDescription( key="energy_real_ac_consumed", - name="Energy consumed", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), FroniusSensorEntityDescription( key="power_real_ac", - name="Power", native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, ), FroniusSensorEntityDescription( key="temperature_channel_1", - name="Temperature channel 1", native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), FroniusSensorEntityDescription( key="error_code", - name="Error code", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="state_code", - name="State code", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="state_message", - name="State message", entity_category=EntityCategory.DIAGNOSTIC, ), ] @@ -534,7 +476,6 @@ OHMPILOT_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ FroniusSensorEntityDescription( key="energy_day", - name="Energy day", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, @@ -542,7 +483,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_year", - name="Energy year", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, @@ -550,7 +490,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="energy_total", - name="Energy total", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, @@ -558,12 +497,10 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="meter_mode", - name="Meter mode", entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="power_battery", - name="Power battery", default_value=0, native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, @@ -571,7 +508,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_grid", - name="Power grid", default_value=0, native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, @@ -579,7 +515,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_load", - name="Power load", default_value=0, native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, @@ -587,7 +522,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_photovoltaics", - name="Power photovoltaics", default_value=0, native_unit_of_measurement=UnitOfPower.WATT, device_class=SensorDeviceClass.POWER, @@ -595,7 +529,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="relative_autonomy", - name="Relative autonomy", default_value=0, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -603,7 +536,6 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="relative_self_consumption", - name="Relative self consumption", default_value=0, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -614,19 +546,16 @@ POWER_FLOW_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ STORAGE_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ FroniusSensorEntityDescription( key="capacity_maximum", - name="Capacity maximum", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="capacity_designed", - name="Capacity designed", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, entity_category=EntityCategory.DIAGNOSTIC, ), FroniusSensorEntityDescription( key="current_dc", - name="Current DC", native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, @@ -634,7 +563,6 @@ STORAGE_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_dc", - name="Voltage DC", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -642,7 +570,6 @@ STORAGE_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_dc_maximum_cell", - name="Voltage DC maximum cell", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -651,7 +578,6 @@ STORAGE_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="voltage_dc_minimum_cell", - name="Voltage DC minimum cell", native_unit_of_measurement=UnitOfElectricPotential.VOLT, device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, @@ -660,14 +586,12 @@ STORAGE_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="state_of_charge", - name="State of charge", native_unit_of_measurement=PERCENTAGE, device_class=SensorDeviceClass.BATTERY, state_class=SensorStateClass.MEASUREMENT, ), FroniusSensorEntityDescription( key="temperature_cell", - name="Temperature cell", native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -696,6 +620,7 @@ class _FroniusSensorEntity(CoordinatorEntity["FroniusCoordinatorBase"], SensorEn ) self.solar_net_id = solar_net_id self._attr_native_value = self._get_entity_value() + self._attr_translation_key = self.entity_description.key def _device_data(self) -> dict[str, Any]: """Extract information for SolarNet device from coordinator data.""" diff --git a/homeassistant/components/fronius/strings.json b/homeassistant/components/fronius/strings.json index 711e363eeba..4a0f96ed8e6 100644 --- a/homeassistant/components/fronius/strings.json +++ b/homeassistant/components/fronius/strings.json @@ -21,5 +21,219 @@ "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "invalid_host": "[%key:common::config_flow::error::invalid_host%]" } + }, + "entity": { + "sensor": { + "energy_day": { + "name": "Energy day" + }, + "energy_year": { + "name": "Energy year" + }, + "energy_total": { + "name": "Total energy" + }, + "frequency_ac": { + "name": "[%key:component::sensor::entity_component::frequency::name%]" + }, + "current_ac": { + "name": "AC current" + }, + "current_dc": { + "name": "DC current" + }, + "current_dc_2": { + "name": "DC current 2" + }, + "power_ac": { + "name": "AC power" + }, + "voltage_ac": { + "name": "AC voltage" + }, + "voltage_dc": { + "name": "DC voltage" + }, + "voltage_dc_2": { + "name": "DC voltage 2" + }, + "inverter_state": { + "name": "Inverter state" + }, + "error_code": { + "name": "Error code" + }, + "status_code": { + "name": "Status code" + }, + "led_state": { + "name": "LED state" + }, + "led_color": { + "name": "LED color" + }, + "co2_factor": { + "name": "COâ‚‚ factor" + }, + "cash_factor": { + "name": "Grid export tariff" + }, + "delivery_factor": { + "name": "Grid import tariff" + }, + "current_ac_phase_1": { + "name": "Current phase 1" + }, + "current_ac_phase_2": { + "name": "Current phase 2" + }, + "current_ac_phase_3": { + "name": "Current phase 3" + }, + "energy_reactive_ac_consumed": { + "name": "Reactive energy consumed" + }, + "energy_reactive_ac_produced": { + "name": "Reactive energy produced" + }, + "energy_real_ac_minus": { + "name": "Real energy minus" + }, + "energy_real_ac_plus": { + "name": "Real energy plus" + }, + "energy_real_consumed": { + "name": "Real energy consumed" + }, + "energy_real_produced": { + "name": "Real energy produced" + }, + "frequency_phase_average": { + "name": "Frequency phase average" + }, + "meter_location": { + "name": "Meter location" + }, + "power_apparent_phase_1": { + "name": "Apparent power phase 1" + }, + "power_apparent_phase_2": { + "name": "Apparent power phase 2" + }, + "power_apparent_phase_3": { + "name": "Apparent power phase 3" + }, + "power_apparent": { + "name": "[%key:component::sensor::entity_component::apparent_power::name%]" + }, + "power_factor_phase_1": { + "name": "Power factor phase 1" + }, + "power_factor_phase_2": { + "name": "Power factor phase 2" + }, + "power_factor_phase_3": { + "name": "Power factor phase 3" + }, + "power_factor": { + "name": "[%key:component::sensor::entity_component::power_factor::name%]" + }, + "power_reactive_phase_1": { + "name": "Reactive power phase 1" + }, + "power_reactive_phase_2": { + "name": "Reactive power phase 2" + }, + "power_reactive_phase_3": { + "name": "Reactive power phase 3" + }, + "power_reactive": { + "name": "Reactive power" + }, + "power_real_phase_1": { + "name": "Real power phase 1" + }, + "power_real_phase_2": { + "name": "Real power phase 2" + }, + "power_real_phase_3": { + "name": "Real power phase 3" + }, + "power_real": { + "name": "Real power" + }, + "voltage_ac_phase_1": { + "name": "Voltage phase 1" + }, + "voltage_ac_phase_2": { + "name": "Voltage phase 2" + }, + "voltage_ac_phase_3": { + "name": "Voltage phase 3" + }, + "voltage_ac_phase_to_phase_12": { + "name": "Voltage phase 1-2" + }, + "voltage_ac_phase_to_phase_23": { + "name": "Voltage phase 2-3" + }, + "voltage_ac_phase_to_phase_31": { + "name": "Voltage phase 3-1" + }, + "energy_real_ac_consumed": { + "name": "Energy consumed" + }, + "power_real_ac": { + "name": "[%key:component::sensor::entity_component::power::name%]" + }, + "temperature_channel_1": { + "name": "[%key:component::sensor::entity_component::temperature::name%]" + }, + "state_code": { + "name": "State code" + }, + "state_message": { + "name": "State message" + }, + "meter_mode": { + "name": "Meter mode" + }, + "power_battery": { + "name": "Power battery" + }, + "power_grid": { + "name": "Power grid" + }, + "power_load": { + "name": "Power load" + }, + "power_photovoltaics": { + "name": "Power photovoltaics" + }, + "relative_autonomy": { + "name": "Relative autonomy" + }, + "relative_self_consumption": { + "name": "Relative self consumption" + }, + "capacity_maximum": { + "name": "Maximum capacity " + }, + "capacity_designed": { + "name": "Designed capacity" + }, + "voltage_dc_maximum_cell": { + "name": "Maximum cell voltage" + }, + "voltage_dc_minimum_cell": { + "name": "Minimum cell voltage" + }, + "state_of_charge": { + "name": "State of charge" + }, + "temperature_cell": { + "name": "[%key:component::sensor::entity_component::temperature::name%]" + } + } } } diff --git a/tests/components/fronius/test_sensor.py b/tests/components/fronius/test_sensor.py index ef881b552fa..59dfeee9f5d 100644 --- a/tests/components/fronius/test_sensor.py +++ b/tests/components/fronius/test_sensor.py @@ -34,11 +34,11 @@ async def test_symo_inverter( hass, config_entry.entry_id, FroniusInverterUpdateCoordinator.default_interval ) assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 52 - assert_state("sensor.symo_20_current_dc", 0) + assert_state("sensor.symo_20_dc_current", 0) assert_state("sensor.symo_20_energy_day", 10828) - assert_state("sensor.symo_20_energy_total", 44186900) + assert_state("sensor.symo_20_total_energy", 44186900) assert_state("sensor.symo_20_energy_year", 25507686) - assert_state("sensor.symo_20_voltage_dc", 16) + assert_state("sensor.symo_20_dc_voltage", 16) # Second test at daytime when inverter is producing mock_responses(aioclient_mock, night=False) @@ -52,15 +52,15 @@ async def test_symo_inverter( ) assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 58 # 4 additional AC entities - assert_state("sensor.symo_20_current_dc", 2.19) + assert_state("sensor.symo_20_dc_current", 2.19) assert_state("sensor.symo_20_energy_day", 1113) - assert_state("sensor.symo_20_energy_total", 44188000) + assert_state("sensor.symo_20_total_energy", 44188000) assert_state("sensor.symo_20_energy_year", 25508798) - assert_state("sensor.symo_20_voltage_dc", 518) - assert_state("sensor.symo_20_current_ac", 5.19) - assert_state("sensor.symo_20_frequency_ac", 49.94) - assert_state("sensor.symo_20_power_ac", 1190) - assert_state("sensor.symo_20_voltage_ac", 227.90) + assert_state("sensor.symo_20_dc_voltage", 518) + assert_state("sensor.symo_20_ac_current", 5.19) + assert_state("sensor.symo_20_frequency", 49.94) + assert_state("sensor.symo_20_ac_power", 1190) + assert_state("sensor.symo_20_ac_voltage", 227.90) # Third test at nighttime - additional AC entities default to 0 mock_responses(aioclient_mock, night=True) @@ -68,10 +68,10 @@ async def test_symo_inverter( hass, dt.utcnow() + FroniusInverterUpdateCoordinator.default_interval ) await hass.async_block_till_done() - assert_state("sensor.symo_20_current_ac", 0) - assert_state("sensor.symo_20_frequency_ac", 0) - assert_state("sensor.symo_20_power_ac", 0) - assert_state("sensor.symo_20_voltage_ac", 0) + assert_state("sensor.symo_20_ac_current", 0) + assert_state("sensor.symo_20_frequency", 0) + assert_state("sensor.symo_20_ac_power", 0) + assert_state("sensor.symo_20_ac_voltage", 0) async def test_symo_logger( @@ -112,38 +112,38 @@ async def test_symo_meter( ) assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 58 # states are rounded to 4 decimals - assert_state("sensor.smart_meter_63a_current_ac_phase_1", 7.755) - assert_state("sensor.smart_meter_63a_current_ac_phase_2", 6.68) - assert_state("sensor.smart_meter_63a_current_ac_phase_3", 10.102) - assert_state("sensor.smart_meter_63a_energy_reactive_ac_consumed", 59960790) - assert_state("sensor.smart_meter_63a_energy_reactive_ac_produced", 723160) - assert_state("sensor.smart_meter_63a_energy_real_ac_minus", 35623065) - assert_state("sensor.smart_meter_63a_energy_real_ac_plus", 15303334) - assert_state("sensor.smart_meter_63a_energy_real_consumed", 15303334) - assert_state("sensor.smart_meter_63a_energy_real_produced", 35623065) + assert_state("sensor.smart_meter_63a_current_phase_1", 7.755) + assert_state("sensor.smart_meter_63a_current_phase_2", 6.68) + assert_state("sensor.smart_meter_63a_current_phase_3", 10.102) + assert_state("sensor.smart_meter_63a_reactive_energy_consumed", 59960790) + assert_state("sensor.smart_meter_63a_reactive_energy_produced", 723160) + assert_state("sensor.smart_meter_63a_real_energy_minus", 35623065) + assert_state("sensor.smart_meter_63a_real_energy_plus", 15303334) + assert_state("sensor.smart_meter_63a_real_energy_consumed", 15303334) + assert_state("sensor.smart_meter_63a_real_energy_produced", 35623065) assert_state("sensor.smart_meter_63a_frequency_phase_average", 50) - assert_state("sensor.smart_meter_63a_power_apparent_phase_1", 1772.793) - assert_state("sensor.smart_meter_63a_power_apparent_phase_2", 1527.048) - assert_state("sensor.smart_meter_63a_power_apparent_phase_3", 2333.562) - assert_state("sensor.smart_meter_63a_power_apparent", 5592.57) + assert_state("sensor.smart_meter_63a_apparent_power_phase_1", 1772.793) + assert_state("sensor.smart_meter_63a_apparent_power_phase_2", 1527.048) + assert_state("sensor.smart_meter_63a_apparent_power_phase_3", 2333.562) + assert_state("sensor.smart_meter_63a_apparent_power", 5592.57) assert_state("sensor.smart_meter_63a_power_factor_phase_1", -0.99) assert_state("sensor.smart_meter_63a_power_factor_phase_2", -0.99) assert_state("sensor.smart_meter_63a_power_factor_phase_3", 0.99) assert_state("sensor.smart_meter_63a_power_factor", 1) - assert_state("sensor.smart_meter_63a_power_reactive_phase_1", 51.48) - assert_state("sensor.smart_meter_63a_power_reactive_phase_2", 115.63) - assert_state("sensor.smart_meter_63a_power_reactive_phase_3", -164.24) - assert_state("sensor.smart_meter_63a_power_reactive", 2.87) - assert_state("sensor.smart_meter_63a_power_real_phase_1", 1765.55) - assert_state("sensor.smart_meter_63a_power_real_phase_2", 1515.8) - assert_state("sensor.smart_meter_63a_power_real_phase_3", 2311.22) - assert_state("sensor.smart_meter_63a_power_real", 5592.57) - assert_state("sensor.smart_meter_63a_voltage_ac_phase_1", 228.6) - assert_state("sensor.smart_meter_63a_voltage_ac_phase_2", 228.6) - assert_state("sensor.smart_meter_63a_voltage_ac_phase_3", 231) - assert_state("sensor.smart_meter_63a_voltage_ac_phase_1_2", 395.9) - assert_state("sensor.smart_meter_63a_voltage_ac_phase_2_3", 398) - assert_state("sensor.smart_meter_63a_voltage_ac_phase_3_1", 398) + assert_state("sensor.smart_meter_63a_reactive_power_phase_1", 51.48) + assert_state("sensor.smart_meter_63a_reactive_power_phase_2", 115.63) + assert_state("sensor.smart_meter_63a_reactive_power_phase_3", -164.24) + assert_state("sensor.smart_meter_63a_reactive_power", 2.87) + assert_state("sensor.smart_meter_63a_real_power_phase_1", 1765.55) + assert_state("sensor.smart_meter_63a_real_power_phase_2", 1515.8) + assert_state("sensor.smart_meter_63a_real_power_phase_3", 2311.22) + assert_state("sensor.smart_meter_63a_real_power", 5592.57) + assert_state("sensor.smart_meter_63a_voltage_phase_1", 228.6) + assert_state("sensor.smart_meter_63a_voltage_phase_2", 228.6) + assert_state("sensor.smart_meter_63a_voltage_phase_3", 231) + assert_state("sensor.smart_meter_63a_voltage_phase_1_2", 395.9) + assert_state("sensor.smart_meter_63a_voltage_phase_2_3", 398) + assert_state("sensor.smart_meter_63a_voltage_phase_3_1", 398) async def test_symo_power_flow( @@ -167,7 +167,7 @@ async def test_symo_power_flow( assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 52 # states are rounded to 4 decimals assert_state("sensor.solarnet_energy_day", 10828) - assert_state("sensor.solarnet_energy_total", 44186900) + assert_state("sensor.solarnet_total_energy", 44186900) assert_state("sensor.solarnet_energy_year", 25507686) assert_state("sensor.solarnet_power_grid", 975.31) assert_state("sensor.solarnet_power_load", -975.31) @@ -182,7 +182,7 @@ async def test_symo_power_flow( # 54 because power_flow `rel_SelfConsumption` and `P_PV` is not `null` anymore assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 54 assert_state("sensor.solarnet_energy_day", 1101.7001) - assert_state("sensor.solarnet_energy_total", 44188000) + assert_state("sensor.solarnet_total_energy", 44188000) assert_state("sensor.solarnet_energy_year", 25508788) assert_state("sensor.solarnet_power_grid", 1703.74) assert_state("sensor.solarnet_power_load", -2814.74) @@ -198,7 +198,7 @@ async def test_symo_power_flow( await hass.async_block_till_done() assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 54 assert_state("sensor.solarnet_energy_day", 10828) - assert_state("sensor.solarnet_energy_total", 44186900) + assert_state("sensor.solarnet_total_energy", 44186900) assert_state("sensor.solarnet_energy_year", 25507686) assert_state("sensor.solarnet_power_grid", 975.31) assert_state("sensor.solarnet_power_load", -975.31) @@ -224,52 +224,52 @@ async def test_gen24(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) - ) assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 52 # inverter 1 - assert_state("sensor.inverter_name_current_ac", 0.1589) - assert_state("sensor.inverter_name_current_dc_2", 0.0754) + assert_state("sensor.inverter_name_ac_current", 0.1589) + assert_state("sensor.inverter_name_dc_current_2", 0.0754) assert_state("sensor.inverter_name_status_code", 7) - assert_state("sensor.inverter_name_current_dc", 0.0783) - assert_state("sensor.inverter_name_voltage_dc_2", 403.4312) - assert_state("sensor.inverter_name_power_ac", 37.3204) + assert_state("sensor.inverter_name_dc_current", 0.0783) + assert_state("sensor.inverter_name_dc_voltage_2", 403.4312) + assert_state("sensor.inverter_name_ac_power", 37.3204) assert_state("sensor.inverter_name_error_code", 0) - assert_state("sensor.inverter_name_voltage_dc", 411.3811) - assert_state("sensor.inverter_name_energy_total", 1530193.42) + assert_state("sensor.inverter_name_dc_voltage", 411.3811) + assert_state("sensor.inverter_name_total_energy", 1530193.42) assert_state("sensor.inverter_name_inverter_state", "Running") - assert_state("sensor.inverter_name_voltage_ac", 234.9168) - assert_state("sensor.inverter_name_frequency_ac", 49.9917) + assert_state("sensor.inverter_name_ac_voltage", 234.9168) + assert_state("sensor.inverter_name_frequency", 49.9917) # meter - assert_state("sensor.smart_meter_ts_65a_3_energy_real_produced", 3863340.0) - assert_state("sensor.smart_meter_ts_65a_3_energy_real_consumed", 2013105.0) - assert_state("sensor.smart_meter_ts_65a_3_power_real", 653.1) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_produced", 3863340.0) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_consumed", 2013105.0) + assert_state("sensor.smart_meter_ts_65a_3_real_power", 653.1) assert_state("sensor.smart_meter_ts_65a_3_frequency_phase_average", 49.9) assert_state("sensor.smart_meter_ts_65a_3_meter_location", 0.0) assert_state("sensor.smart_meter_ts_65a_3_power_factor", 0.828) - assert_state("sensor.smart_meter_ts_65a_3_energy_reactive_ac_consumed", 88221.0) - assert_state("sensor.smart_meter_ts_65a_3_energy_real_ac_minus", 3863340.0) - assert_state("sensor.smart_meter_ts_65a_3_current_ac_phase_2", 2.33) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_1", 235.9) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_1_2", 408.7) - assert_state("sensor.smart_meter_ts_65a_3_power_real_phase_2", 294.9) - assert_state("sensor.smart_meter_ts_65a_3_energy_real_ac_plus", 2013105.0) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_2", 236.1) - assert_state("sensor.smart_meter_ts_65a_3_energy_reactive_ac_produced", 1989125.0) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_3", 236.9) + assert_state("sensor.smart_meter_ts_65a_3_reactive_energy_consumed", 88221.0) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_minus", 3863340.0) + assert_state("sensor.smart_meter_ts_65a_3_current_phase_2", 2.33) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_1", 235.9) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_1_2", 408.7) + assert_state("sensor.smart_meter_ts_65a_3_real_power_phase_2", 294.9) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_plus", 2013105.0) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_2", 236.1) + assert_state("sensor.smart_meter_ts_65a_3_reactive_energy_produced", 1989125.0) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_3", 236.9) assert_state("sensor.smart_meter_ts_65a_3_power_factor_phase_1", 0.441) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_2_3", 409.6) - assert_state("sensor.smart_meter_ts_65a_3_current_ac_phase_3", 1.825) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_2_3", 409.6) + assert_state("sensor.smart_meter_ts_65a_3_current_phase_3", 1.825) assert_state("sensor.smart_meter_ts_65a_3_power_factor_phase_3", 0.832) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent_phase_1", 243.3) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_3_1", 409.4) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent_phase_2", 323.4) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent_phase_3", 301.2) - assert_state("sensor.smart_meter_ts_65a_3_power_real_phase_1", 106.8) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power_phase_1", 243.3) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_3_1", 409.4) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power_phase_2", 323.4) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power_phase_3", 301.2) + assert_state("sensor.smart_meter_ts_65a_3_real_power_phase_1", 106.8) assert_state("sensor.smart_meter_ts_65a_3_power_factor_phase_2", 0.934) - assert_state("sensor.smart_meter_ts_65a_3_power_real_phase_3", 251.3) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive_phase_1", -218.6) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive_phase_2", -132.8) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive_phase_3", -166.0) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent", 868.0) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive", -517.4) - assert_state("sensor.smart_meter_ts_65a_3_current_ac_phase_1", 1.145) + assert_state("sensor.smart_meter_ts_65a_3_real_power_phase_3", 251.3) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power_phase_1", -218.6) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power_phase_2", -132.8) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power_phase_3", -166.0) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power", 868.0) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power", -517.4) + assert_state("sensor.smart_meter_ts_65a_3_current_phase_1", 1.145) # power_flow assert_state("sensor.solarnet_power_grid", 658.4) assert_state("sensor.solarnet_relative_self_consumption", 100.0) @@ -277,7 +277,7 @@ async def test_gen24(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) - assert_state("sensor.solarnet_power_load", -695.6827) assert_state("sensor.solarnet_meter_mode", "meter") assert_state("sensor.solarnet_relative_autonomy", 5.3592) - assert_state("sensor.solarnet_energy_total", 1530193.42) + assert_state("sensor.solarnet_total_energy", 1530193.42) async def test_gen24_storage( @@ -301,56 +301,56 @@ async def test_gen24_storage( ) assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 64 # inverter 1 - assert_state("sensor.gen24_storage_current_dc", 0.3952) - assert_state("sensor.gen24_storage_voltage_dc_2", 318.8103) - assert_state("sensor.gen24_storage_current_dc_2", 0.3564) - assert_state("sensor.gen24_storage_current_ac", 1.1087) - assert_state("sensor.gen24_storage_power_ac", 250.9093) + assert_state("sensor.gen24_storage_dc_current", 0.3952) + assert_state("sensor.gen24_storage_dc_voltage_2", 318.8103) + assert_state("sensor.gen24_storage_dc_current_2", 0.3564) + assert_state("sensor.gen24_storage_ac_current", 1.1087) + assert_state("sensor.gen24_storage_ac_power", 250.9093) assert_state("sensor.gen24_storage_error_code", 0) assert_state("sensor.gen24_storage_status_code", 7) - assert_state("sensor.gen24_storage_energy_total", 7512794.0117) + assert_state("sensor.gen24_storage_total_energy", 7512794.0117) assert_state("sensor.gen24_storage_inverter_state", "Running") - assert_state("sensor.gen24_storage_voltage_dc", 419.1009) - assert_state("sensor.gen24_storage_voltage_ac", 227.354) - assert_state("sensor.gen24_storage_frequency_ac", 49.9816) + assert_state("sensor.gen24_storage_dc_voltage", 419.1009) + assert_state("sensor.gen24_storage_ac_voltage", 227.354) + assert_state("sensor.gen24_storage_frequency", 49.9816) # meter - assert_state("sensor.smart_meter_ts_65a_3_energy_real_produced", 1705128.0) - assert_state("sensor.smart_meter_ts_65a_3_power_real", 487.7) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_produced", 1705128.0) + assert_state("sensor.smart_meter_ts_65a_3_real_power", 487.7) assert_state("sensor.smart_meter_ts_65a_3_power_factor", 0.698) - assert_state("sensor.smart_meter_ts_65a_3_energy_real_consumed", 1247204.0) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_consumed", 1247204.0) assert_state("sensor.smart_meter_ts_65a_3_frequency_phase_average", 49.9) assert_state("sensor.smart_meter_ts_65a_3_meter_location", 0.0) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive", -501.5) - assert_state("sensor.smart_meter_ts_65a_3_energy_reactive_ac_produced", 3266105.0) - assert_state("sensor.smart_meter_ts_65a_3_power_real_phase_3", 19.6) - assert_state("sensor.smart_meter_ts_65a_3_current_ac_phase_3", 0.645) - assert_state("sensor.smart_meter_ts_65a_3_energy_real_ac_minus", 1705128.0) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent_phase_2", 383.9) - assert_state("sensor.smart_meter_ts_65a_3_current_ac_phase_1", 1.701) - assert_state("sensor.smart_meter_ts_65a_3_current_ac_phase_2", 1.832) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent_phase_1", 319.5) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_1", 229.4) - assert_state("sensor.smart_meter_ts_65a_3_power_real_phase_2", 150.0) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_3_1", 394.3) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_2", 225.6) - assert_state("sensor.smart_meter_ts_65a_3_energy_reactive_ac_consumed", 5482.0) - assert_state("sensor.smart_meter_ts_65a_3_energy_real_ac_plus", 1247204.0) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power", -501.5) + assert_state("sensor.smart_meter_ts_65a_3_reactive_energy_produced", 3266105.0) + assert_state("sensor.smart_meter_ts_65a_3_real_power_phase_3", 19.6) + assert_state("sensor.smart_meter_ts_65a_3_current_phase_3", 0.645) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_minus", 1705128.0) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power_phase_2", 383.9) + assert_state("sensor.smart_meter_ts_65a_3_current_phase_1", 1.701) + assert_state("sensor.smart_meter_ts_65a_3_current_phase_2", 1.832) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power_phase_1", 319.5) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_1", 229.4) + assert_state("sensor.smart_meter_ts_65a_3_real_power_phase_2", 150.0) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_3_1", 394.3) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_2", 225.6) + assert_state("sensor.smart_meter_ts_65a_3_reactive_energy_consumed", 5482.0) + assert_state("sensor.smart_meter_ts_65a_3_real_energy_plus", 1247204.0) assert_state("sensor.smart_meter_ts_65a_3_power_factor_phase_1", 0.995) assert_state("sensor.smart_meter_ts_65a_3_power_factor_phase_3", 0.163) assert_state("sensor.smart_meter_ts_65a_3_power_factor_phase_2", 0.389) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive_phase_1", -31.3) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive_phase_3", -116.7) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_1_2", 396.0) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_2_3", 393.0) - assert_state("sensor.smart_meter_ts_65a_3_power_reactive_phase_2", -353.4) - assert_state("sensor.smart_meter_ts_65a_3_power_real_phase_1", 317.9) - assert_state("sensor.smart_meter_ts_65a_3_voltage_ac_phase_3", 228.3) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent", 821.9) - assert_state("sensor.smart_meter_ts_65a_3_power_apparent_phase_3", 118.4) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power_phase_1", -31.3) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power_phase_3", -116.7) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_1_2", 396.0) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_2_3", 393.0) + assert_state("sensor.smart_meter_ts_65a_3_reactive_power_phase_2", -353.4) + assert_state("sensor.smart_meter_ts_65a_3_real_power_phase_1", 317.9) + assert_state("sensor.smart_meter_ts_65a_3_voltage_phase_3", 228.3) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power", 821.9) + assert_state("sensor.smart_meter_ts_65a_3_apparent_power_phase_3", 118.4) # ohmpilot assert_state("sensor.ohmpilot_energy_consumed", 1233295.0) assert_state("sensor.ohmpilot_power", 0.0) - assert_state("sensor.ohmpilot_temperature_channel_1", 38.9) + assert_state("sensor.ohmpilot_temperature", 38.9) assert_state("sensor.ohmpilot_state_code", 0.0) assert_state("sensor.ohmpilot_state_message", "Up and running") # power_flow @@ -361,14 +361,14 @@ async def test_gen24_storage( assert_state("sensor.solarnet_power_photovoltaics", 216.4328) assert_state("sensor.solarnet_relative_autonomy", 7.4984) assert_state("sensor.solarnet_meter_mode", "bidirectional") - assert_state("sensor.solarnet_energy_total", 7512664.4042) + assert_state("sensor.solarnet_total_energy", 7512664.4042) # storage - assert_state("sensor.byd_battery_box_premium_hv_current_dc", 0.0) + assert_state("sensor.byd_battery_box_premium_hv_dc_current", 0.0) assert_state("sensor.byd_battery_box_premium_hv_state_of_charge", 4.6) - assert_state("sensor.byd_battery_box_premium_hv_capacity_maximum", 16588) - assert_state("sensor.byd_battery_box_premium_hv_temperature_cell", 21.5) - assert_state("sensor.byd_battery_box_premium_hv_capacity_designed", 16588) - assert_state("sensor.byd_battery_box_premium_hv_voltage_dc", 0.0) + assert_state("sensor.byd_battery_box_premium_hv_maximum_capacity", 16588) + assert_state("sensor.byd_battery_box_premium_hv_temperature", 21.5) + assert_state("sensor.byd_battery_box_premium_hv_designed_capacity", 16588) + assert_state("sensor.byd_battery_box_premium_hv_dc_voltage", 0.0) # Devices device_registry = dr.async_get(hass) @@ -427,36 +427,36 @@ async def test_primo_s0( assert_state("sensor.solarnet_co2_factor", 0.53) assert_state("sensor.solarnet_grid_import_tariff", 1) # inverter 1 - assert_state("sensor.primo_5_0_1_energy_total", 17114940) + assert_state("sensor.primo_5_0_1_total_energy", 17114940) assert_state("sensor.primo_5_0_1_energy_day", 22504) - assert_state("sensor.primo_5_0_1_voltage_dc", 452.3) - assert_state("sensor.primo_5_0_1_power_ac", 862) + assert_state("sensor.primo_5_0_1_dc_voltage", 452.3) + assert_state("sensor.primo_5_0_1_ac_power", 862) assert_state("sensor.primo_5_0_1_error_code", 0) - assert_state("sensor.primo_5_0_1_current_dc", 4.23) + assert_state("sensor.primo_5_0_1_dc_current", 4.23) assert_state("sensor.primo_5_0_1_status_code", 7) assert_state("sensor.primo_5_0_1_energy_year", 7532755.5) - assert_state("sensor.primo_5_0_1_current_ac", 3.85) - assert_state("sensor.primo_5_0_1_voltage_ac", 223.9) - assert_state("sensor.primo_5_0_1_frequency_ac", 60) + assert_state("sensor.primo_5_0_1_ac_current", 3.85) + assert_state("sensor.primo_5_0_1_ac_voltage", 223.9) + assert_state("sensor.primo_5_0_1_frequency", 60) assert_state("sensor.primo_5_0_1_led_color", 2) assert_state("sensor.primo_5_0_1_led_state", 0) # inverter 2 - assert_state("sensor.primo_3_0_1_energy_total", 5796010) + assert_state("sensor.primo_3_0_1_total_energy", 5796010) assert_state("sensor.primo_3_0_1_energy_day", 14237) - assert_state("sensor.primo_3_0_1_voltage_dc", 329.5) - assert_state("sensor.primo_3_0_1_power_ac", 296) + assert_state("sensor.primo_3_0_1_dc_voltage", 329.5) + assert_state("sensor.primo_3_0_1_ac_power", 296) assert_state("sensor.primo_3_0_1_error_code", 0) - assert_state("sensor.primo_3_0_1_current_dc", 0.97) + assert_state("sensor.primo_3_0_1_dc_current", 0.97) assert_state("sensor.primo_3_0_1_status_code", 7) assert_state("sensor.primo_3_0_1_energy_year", 3596193.25) - assert_state("sensor.primo_3_0_1_current_ac", 1.32) - assert_state("sensor.primo_3_0_1_voltage_ac", 223.6) - assert_state("sensor.primo_3_0_1_frequency_ac", 60.01) + assert_state("sensor.primo_3_0_1_ac_current", 1.32) + assert_state("sensor.primo_3_0_1_ac_voltage", 223.6) + assert_state("sensor.primo_3_0_1_frequency", 60.01) assert_state("sensor.primo_3_0_1_led_color", 2) assert_state("sensor.primo_3_0_1_led_state", 0) # meter assert_state("sensor.s0_meter_at_inverter_1_meter_location", 1) - assert_state("sensor.s0_meter_at_inverter_1_power_real", -2216.7487) + assert_state("sensor.s0_meter_at_inverter_1_real_power", -2216.7487) # power_flow assert_state("sensor.solarnet_power_load", -2218.9349) assert_state("sensor.solarnet_meter_mode", "vague-meter") @@ -464,7 +464,7 @@ async def test_primo_s0( assert_state("sensor.solarnet_power_grid", 384.9349) assert_state("sensor.solarnet_relative_self_consumption", 100) assert_state("sensor.solarnet_relative_autonomy", 82.6523) - assert_state("sensor.solarnet_energy_total", 22910919.5) + assert_state("sensor.solarnet_total_energy", 22910919.5) assert_state("sensor.solarnet_energy_day", 36724) assert_state("sensor.solarnet_energy_year", 11128933.25) -- GitLab