From 979165669c017423535ba9ede1d5d6d943cb43f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Mon, 16 Aug 2021 15:57:23 +0200 Subject: [PATCH] Update mill to use state class total (#54581) --- homeassistant/components/mill/sensor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mill/sensor.py b/homeassistant/components/mill/sensor.py index a8b4554139f..5241f95abdb 100644 --- a/homeassistant/components/mill/sensor.py +++ b/homeassistant/components/mill/sensor.py @@ -2,7 +2,7 @@ from homeassistant.components.sensor import ( DEVICE_CLASS_ENERGY, - STATE_CLASS_MEASUREMENT, + STATE_CLASS_TOTAL, SensorEntity, ) from homeassistant.const import ENERGY_KILO_WATT_HOUR @@ -27,17 +27,18 @@ async def async_setup_entry(hass, entry, async_add_entities): class MillHeaterEnergySensor(SensorEntity): """Representation of a Mill Sensor device.""" + _attr_device_class = DEVICE_CLASS_ENERGY + _attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR + _attr_state_class = STATE_CLASS_TOTAL + def __init__(self, heater, mill_data_connection, sensor_type): """Initialize the sensor.""" self._id = heater.device_id self._conn = mill_data_connection self._sensor_type = sensor_type - self._attr_device_class = DEVICE_CLASS_ENERGY self._attr_name = f"{heater.name} {sensor_type.replace('_', ' ')}" self._attr_unique_id = f"{heater.device_id}_{sensor_type}" - self._attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR - self._attr_state_class = STATE_CLASS_MEASUREMENT self._attr_device_info = { "identifiers": {(DOMAIN, heater.device_id)}, "name": self.name,