Use new SensorDeviceClass enum in emonitor (#61385)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-09 22:20:06 +01:00 committed by GitHub
parent 497f036af6
commit f512bacfc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
from aioemonitor.monitor import EmonitorChannel
from homeassistant.components.sensor import DEVICE_CLASS_POWER, SensorEntity
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import POWER_WATT
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.entity import DeviceInfo
@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class EmonitorPowerSensor(CoordinatorEntity, SensorEntity):
"""Representation of an Emonitor power sensor entity."""
_attr_device_class = DEVICE_CLASS_POWER
_attr_device_class = SensorDeviceClass.POWER
_attr_native_unit_of_measurement = POWER_WATT
def __init__(self, coordinator: DataUpdateCoordinator, channel_number: int) -> None: