Use enums in obihai (#62078)

pull/62147/head
Robert Hillis 2021-12-16 16:18:28 -05:00 committed by GitHub
parent dab1a786a5
commit 06f670272f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 7 deletions

View File

@ -5,13 +5,12 @@ import logging
from pyobihai import PyObihai
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_USERNAME,
DEVICE_CLASS_TIMESTAMP,
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
@ -105,7 +104,7 @@ class ObihaiServiceSensors(SensorEntity):
def device_class(self):
"""Return the device class for uptime sensor."""
if self._service_name == "Last Reboot":
return DEVICE_CLASS_TIMESTAMP
return SensorDeviceClass.TIMESTAMP
return None
@property