Use state class enum in Mill (#60726)

pull/60814/head
Daniel Hjelseth Høyer 2021-12-01 17:53:04 +01:00 committed by GitHub
parent 64a4218a24
commit 30e573b694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -4,11 +4,10 @@ from __future__ import annotations
import mill
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
CONCENTRATION_PARTS_PER_BILLION,
@ -43,14 +42,14 @@ HEATER_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key=CONSUMPTION_YEAR,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL_INCREASING,
name="Year consumption",
),
SensorEntityDescription(
key=CONSUMPTION_TODAY,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL_INCREASING,
name="Day consumption",
),
)
@ -61,21 +60,21 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS,
name="Temperature",
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key=HUMIDITY,
device_class=SensorDeviceClass.HUMIDITY,
native_unit_of_measurement=PERCENTAGE,
name="Humidity",
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key=BATTERY,
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=PERCENTAGE,
name="Battery",
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
SensorEntityDescription(
@ -88,7 +87,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key=TVOC,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
name="TVOC",
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
),
)