mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use ENERGY device class in landisgyr heat meter (#84223)
This commit is contained in:
parent
52594717ca
commit
1f60296415
@ -6,13 +6,12 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ENERGY_MEGA_WATT_HOUR,
|
|
||||||
TEMP_CELSIUS,
|
|
||||||
TIME_HOURS,
|
|
||||||
TIME_MINUTES,
|
|
||||||
VOLUME_CUBIC_METERS,
|
|
||||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||||
|
UnitOfEnergy,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
|
UnitOfTemperature,
|
||||||
|
UnitOfTime,
|
||||||
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
key="heat_usage",
|
key="heat_usage",
|
||||||
icon="mdi:fire",
|
icon="mdi:fire",
|
||||||
name="Heat usage",
|
name="Heat usage",
|
||||||
native_unit_of_measurement=ENERGY_MEGA_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.MEGA_WATT_HOUR,
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
state_class=SensorStateClass.TOTAL,
|
state_class=SensorStateClass.TOTAL,
|
||||||
),
|
),
|
||||||
@ -35,7 +34,7 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
icon="mdi:fire",
|
icon="mdi:fire",
|
||||||
name="Volume usage",
|
name="Volume usage",
|
||||||
device_class=SensorDeviceClass.VOLUME,
|
device_class=SensorDeviceClass.VOLUME,
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
state_class=SensorStateClass.TOTAL,
|
state_class=SensorStateClass.TOTAL,
|
||||||
),
|
),
|
||||||
# Diagnostic entity for debugging, this will match the value in GJ indicated on the meter's display
|
# Diagnostic entity for debugging, this will match the value in GJ indicated on the meter's display
|
||||||
@ -50,7 +49,8 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
key="heat_previous_year",
|
key="heat_previous_year",
|
||||||
icon="mdi:fire",
|
icon="mdi:fire",
|
||||||
name="Heat usage previous year",
|
name="Heat usage previous year",
|
||||||
native_unit_of_measurement=ENERGY_MEGA_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.MEGA_WATT_HOUR,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
# Diagnostic entity for debugging, this will match the value in GJ of previous year indicated on the meter's display
|
# Diagnostic entity for debugging, this will match the value in GJ of previous year indicated on the meter's display
|
||||||
@ -66,7 +66,7 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
icon="mdi:fire",
|
icon="mdi:fire",
|
||||||
name="Volume usage previous year",
|
name="Volume usage previous year",
|
||||||
device_class=SensorDeviceClass.VOLUME,
|
device_class=SensorDeviceClass.VOLUME,
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
@ -91,7 +91,7 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
key="measurement_period_minutes",
|
key="measurement_period_minutes",
|
||||||
name="Measurement period minutes",
|
name="Measurement period minutes",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
@ -125,28 +125,28 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="return_temperature_max_c",
|
key="return_temperature_max_c",
|
||||||
name="Return temperature max",
|
name="Return temperature max",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="return_temperature_max_previous_year_c",
|
key="return_temperature_max_previous_year_c",
|
||||||
name="Return temperature max previous year",
|
name="Return temperature max previous year",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="flow_temperature_max_c",
|
key="flow_temperature_max_c",
|
||||||
name="Flow temperature max",
|
name="Flow temperature max",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="flow_temperature_max_previous_year_c",
|
key="flow_temperature_max_previous_year_c",
|
||||||
name="Flow temperature max previous year",
|
name="Flow temperature max previous year",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
@ -154,28 +154,28 @@ HEAT_METER_SENSOR_TYPES = (
|
|||||||
key="operating_hours",
|
key="operating_hours",
|
||||||
name="Operating hours",
|
name="Operating hours",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_HOURS,
|
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="flow_hours",
|
key="flow_hours",
|
||||||
name="Flow hours",
|
name="Flow hours",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_HOURS,
|
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="fault_hours",
|
key="fault_hours",
|
||||||
name="Fault hours",
|
name="Fault hours",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_HOURS,
|
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="fault_hours_previous_year",
|
key="fault_hours_previous_year",
|
||||||
name="Fault hours previous year",
|
name="Fault hours previous year",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_HOURS,
|
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user