Use new enums in smart_meter_texas (#62210)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/62284/head
epenet 2021-12-18 14:53:50 +01:00 committed by GitHub
parent ac0fa3cbf8
commit a39f0643e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -1,8 +1,12 @@
"""Support for Smart Meter Texas sensors."""
from smart_meter_texas import Meter
from homeassistant.components.sensor import STATE_CLASS_TOTAL_INCREASING, SensorEntity
from homeassistant.const import CONF_ADDRESS, DEVICE_CLASS_ENERGY, ENERGY_KILO_WATT_HOUR
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
from homeassistant.const import CONF_ADDRESS, ENERGY_KILO_WATT_HOUR
from homeassistant.core import callback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.update_coordinator import (
@ -33,8 +37,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
"""Representation of an Smart Meter Texas sensor."""
_attr_device_class = DEVICE_CLASS_ENERGY
_attr_state_class = STATE_CLASS_TOTAL_INCREASING
_attr_device_class = SensorDeviceClass.ENERGY
_attr_state_class = SensorStateClass.TOTAL_INCREASING
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
def __init__(self, meter: Meter, coordinator: DataUpdateCoordinator) -> None: