diff --git a/homeassistant/components/sense/binary_sensor.py b/homeassistant/components/sense/binary_sensor.py index ae5e4fc95bc..99591438e32 100644 --- a/homeassistant/components/sense/binary_sensor.py +++ b/homeassistant/components/sense/binary_sensor.py @@ -1,8 +1,11 @@ """Support for monitoring a Sense energy sensor device.""" import logging -from homeassistant.components.binary_sensor import BinarySensorEntity -from homeassistant.const import ATTR_ATTRIBUTION, DEVICE_CLASS_POWER +from homeassistant.components.binary_sensor import ( + BinarySensorDeviceClass, + BinarySensorEntity, +) +from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_registry import async_get_registry @@ -113,7 +116,7 @@ class SenseDevice(BinarySensorEntity): @property def device_class(self): """Return the device class of the binary sensor.""" - return DEVICE_CLASS_POWER + return BinarySensorDeviceClass.POWER @property def should_poll(self): diff --git a/homeassistant/components/sense/sensor.py b/homeassistant/components/sense/sensor.py index 08677cda8d0..b5fdb4398c0 100644 --- a/homeassistant/components/sense/sensor.py +++ b/homeassistant/components/sense/sensor.py @@ -1,13 +1,11 @@ """Support for monitoring a Sense energy sensor.""" from homeassistant.components.sensor import ( - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL, + SensorDeviceClass, SensorEntity, + SensorStateClass, ) from homeassistant.const import ( ATTR_ATTRIBUTION, - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_POWER, ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, PERCENTAGE, @@ -157,7 +155,7 @@ class SenseActiveSensor(SensorEntity): _attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} _attr_should_poll = False _attr_available = False - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__( self, @@ -250,8 +248,8 @@ class SenseVoltageSensor(SensorEntity): class SenseTrendsSensor(CoordinatorEntity, SensorEntity): """Implementation of a Sense energy sensor.""" - _attr_device_class = DEVICE_CLASS_ENERGY - _attr_state_class = STATE_CLASS_TOTAL + _attr_device_class = SensorDeviceClass.ENERGY + _attr_state_class = SensorStateClass.TOTAL _attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR _attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} _attr_icon = ICON @@ -299,10 +297,10 @@ class SenseEnergyDevice(SensorEntity): """Implementation of a Sense energy device.""" _attr_available = False - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT _attr_native_unit_of_measurement = POWER_WATT _attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} - _attr_device_class = DEVICE_CLASS_POWER + _attr_device_class = SensorDeviceClass.POWER _attr_should_poll = False def __init__(self, sense_devices_data, device, sense_monitor_id):