diff --git a/homeassistant/components/landisgyr_heat_meter/const.py b/homeassistant/components/landisgyr_heat_meter/const.py index 4956539eceb..c17a119a6c3 100644 --- a/homeassistant/components/landisgyr_heat_meter/const.py +++ b/homeassistant/components/landisgyr_heat_meter/const.py @@ -6,13 +6,12 @@ from homeassistant.components.sensor import ( SensorStateClass, ) from homeassistant.const import ( - ENERGY_MEGA_WATT_HOUR, - TEMP_CELSIUS, - TIME_HOURS, - TIME_MINUTES, - VOLUME_CUBIC_METERS, VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR, + UnitOfEnergy, UnitOfPower, + UnitOfTemperature, + UnitOfTime, + UnitOfVolume, ) from homeassistant.helpers.entity import EntityCategory @@ -26,7 +25,7 @@ HEAT_METER_SENSOR_TYPES = ( key="heat_usage", icon="mdi:fire", name="Heat usage", - native_unit_of_measurement=ENERGY_MEGA_WATT_HOUR, + native_unit_of_measurement=UnitOfEnergy.MEGA_WATT_HOUR, device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL, ), @@ -35,7 +34,7 @@ HEAT_METER_SENSOR_TYPES = ( icon="mdi:fire", name="Volume usage", device_class=SensorDeviceClass.VOLUME, - native_unit_of_measurement=VOLUME_CUBIC_METERS, + native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, state_class=SensorStateClass.TOTAL, ), # 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", icon="mdi:fire", 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, ), # 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", name="Volume usage previous year", device_class=SensorDeviceClass.VOLUME, - native_unit_of_measurement=VOLUME_CUBIC_METERS, + native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( @@ -91,7 +91,7 @@ HEAT_METER_SENSOR_TYPES = ( key="measurement_period_minutes", name="Measurement period minutes", device_class=SensorDeviceClass.DURATION, - native_unit_of_measurement=TIME_MINUTES, + native_unit_of_measurement=UnitOfTime.MINUTES, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( @@ -125,28 +125,28 @@ HEAT_METER_SENSOR_TYPES = ( SensorEntityDescription( key="return_temperature_max_c", name="Return temperature max", - native_unit_of_measurement=TEMP_CELSIUS, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="return_temperature_max_previous_year_c", name="Return temperature max previous year", - native_unit_of_measurement=TEMP_CELSIUS, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="flow_temperature_max_c", name="Flow temperature max", - native_unit_of_measurement=TEMP_CELSIUS, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="flow_temperature_max_previous_year_c", name="Flow temperature max previous year", - native_unit_of_measurement=TEMP_CELSIUS, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, device_class=SensorDeviceClass.TEMPERATURE, entity_category=EntityCategory.DIAGNOSTIC, ), @@ -154,28 +154,28 @@ HEAT_METER_SENSOR_TYPES = ( key="operating_hours", name="Operating hours", device_class=SensorDeviceClass.DURATION, - native_unit_of_measurement=TIME_HOURS, + native_unit_of_measurement=UnitOfTime.HOURS, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="flow_hours", name="Flow hours", device_class=SensorDeviceClass.DURATION, - native_unit_of_measurement=TIME_HOURS, + native_unit_of_measurement=UnitOfTime.HOURS, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="fault_hours", name="Fault hours", device_class=SensorDeviceClass.DURATION, - native_unit_of_measurement=TIME_HOURS, + native_unit_of_measurement=UnitOfTime.HOURS, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription( key="fault_hours_previous_year", name="Fault hours previous year", device_class=SensorDeviceClass.DURATION, - native_unit_of_measurement=TIME_HOURS, + native_unit_of_measurement=UnitOfTime.HOURS, entity_category=EntityCategory.DIAGNOSTIC, ), SensorEntityDescription(