Use enums in uptime (#62032)

pull/62067/head
Robert Hillis 2021-12-16 08:13:43 -05:00 committed by GitHub
parent 9e30e0c9bd
commit 1dab28a957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -3,12 +3,12 @@ from __future__ import annotations
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_NAME,
CONF_UNIT_OF_MEASUREMENT,
DEVICE_CLASS_TIMESTAMP,
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
)
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -48,6 +48,6 @@ class UptimeSensor(SensorEntity):
def __init__(self, name: str) -> None:
"""Initialize the uptime sensor."""
self._attr_name: str = name
self._attr_device_class: str = DEVICE_CLASS_TIMESTAMP
self._attr_device_class = SensorDeviceClass.TIMESTAMP
self._attr_should_poll: bool = False
self._attr_native_value = dt_util.utcnow()