Use SensorDeviceClass and SensorStateClass enums in Aurora ABB (#61245)

This commit is contained in:
Dave T 2021-12-08 17:01:52 +00:00 committed by GitHub
parent f30eb05870
commit af91addc6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,19 +10,16 @@ import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
CONF_ADDRESS,
CONF_DEVICE,
CONF_NAME,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
ENERGY_KILO_WATT_HOUR,
POWER_WATT,
TEMP_CELSIUS,
@ -37,23 +34,23 @@ _LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = [
SensorEntityDescription(
key="instantaneouspower",
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=POWER_WATT,
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
name="Power Output",
),
SensorEntityDescription(
key="temp",
device_class=DEVICE_CLASS_TEMPERATURE,
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS,
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
name="Temperature",
),
SensorEntityDescription(
key="totalenergy",
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL_INCREASING,
name="Total Energy",
),
]