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,