Use enums in rova (#62044)

This commit is contained in:
Robert Hillis 2021-12-16 08:42:43 -05:00 committed by GitHub
parent 093202f138
commit fa522fc504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,14 +10,11 @@ import voluptuous as vol
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
) )
from homeassistant.const import ( from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME
CONF_MONITORED_CONDITIONS,
CONF_NAME,
DEVICE_CLASS_TIMESTAMP,
)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle from homeassistant.util import Throttle
from homeassistant.util.dt import get_time_zone, now from homeassistant.util.dt import get_time_zone, now
@ -110,7 +107,7 @@ class RovaSensor(SensorEntity):
self.data_service = data_service self.data_service = data_service
self._attr_name = f"{platform_name}_{description.name}" self._attr_name = f"{platform_name}_{description.name}"
self._attr_device_class = DEVICE_CLASS_TIMESTAMP self._attr_device_class = SensorDeviceClass.TIMESTAMP
def update(self): def update(self):
"""Get the latest data from the sensor and update the state.""" """Get the latest data from the sensor and update the state."""