mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use enums in uptime (#62032)
This commit is contained in:
parent
9e30e0c9bd
commit
1dab28a957
@ -3,12 +3,12 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import (
|
||||||
from homeassistant.const import (
|
PLATFORM_SCHEMA,
|
||||||
CONF_NAME,
|
SensorDeviceClass,
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
SensorEntity,
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -48,6 +48,6 @@ class UptimeSensor(SensorEntity):
|
|||||||
def __init__(self, name: str) -> None:
|
def __init__(self, name: str) -> None:
|
||||||
"""Initialize the uptime sensor."""
|
"""Initialize the uptime sensor."""
|
||||||
self._attr_name: str = name
|
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_should_poll: bool = False
|
||||||
self._attr_native_value = dt_util.utcnow()
|
self._attr_native_value = dt_util.utcnow()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user