Use enums in wemo ()

* Use enums in wemo

* uno mas
This commit is contained in:
Robert Hillis 2021-12-16 03:02:23 -05:00 committed by GitHub
parent 2e0fc65bf3
commit b8dabfe659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,17 +2,12 @@
import asyncio import asyncio
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT, SensorDeviceClass,
STATE_CLASS_TOTAL_INCREASING,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.const import ( from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
ENERGY_KILO_WATT_HOUR,
POWER_WATT,
)
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.typing import StateType from homeassistant.helpers.typing import StateType
from homeassistant.util import convert from homeassistant.util import convert
@ -69,8 +64,8 @@ class InsightCurrentPower(InsightSensor):
entity_description = SensorEntityDescription( entity_description = SensorEntityDescription(
key="currentpower", key="currentpower",
name="Current Power", name="Current Power",
device_class=DEVICE_CLASS_POWER, device_class=SensorDeviceClass.POWER,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_WATT, native_unit_of_measurement=POWER_WATT,
) )
@ -91,8 +86,8 @@ class InsightTodayEnergy(InsightSensor):
entity_description = SensorEntityDescription( entity_description = SensorEntityDescription(
key="todaymw", key="todaymw",
name="Today Energy", name="Today Energy",
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
) )