Correct units for sensors in nibe heatpump (#80140)
parent
5ab97e9f93
commit
b0d2f55f16
|
@ -19,6 +19,7 @@ from homeassistant.const import (
|
|||
ENERGY_KILO_WATT_HOUR,
|
||||
ENERGY_MEGA_WATT_HOUR,
|
||||
ENERGY_WATT_HOUR,
|
||||
POWER_WATT,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
TIME_HOURS,
|
||||
|
@ -72,24 +73,31 @@ UNIT_DESCRIPTIONS = {
|
|||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_MILLIVOLT,
|
||||
),
|
||||
"W": SensorEntityDescription(
|
||||
key="W",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
),
|
||||
"Wh": SensorEntityDescription(
|
||||
key="Wh",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=ENERGY_WATT_HOUR,
|
||||
),
|
||||
"kWh": SensorEntityDescription(
|
||||
key="kWh",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
||||
),
|
||||
"MWh": SensorEntityDescription(
|
||||
key="MWh",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=ENERGY_MEGA_WATT_HOUR,
|
||||
),
|
||||
|
@ -97,6 +105,7 @@ UNIT_DESCRIPTIONS = {
|
|||
key="h",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.DURATION,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=TIME_HOURS,
|
||||
),
|
||||
}
|
||||
|
@ -133,6 +142,7 @@ class Sensor(CoilEntity, SensorEntity):
|
|||
self.entity_description = entity_description
|
||||
else:
|
||||
self._attr_native_unit_of_measurement = coil.unit
|
||||
self._attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
|
||||
def _async_read_coil(self, coil: Coil):
|
||||
self._attr_native_value = coil.value
|
||||
|
|
Loading…
Reference in New Issue