From 6a489bb45a83f7cb8c8bfe8b5e8b6e8c11909ae3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sun, 19 Dec 2021 13:06:36 +0100 Subject: [PATCH] Cleanup attr** usage in uptime (#62212) Co-authored-by: epenet --- homeassistant/components/uptime/sensor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/uptime/sensor.py b/homeassistant/components/uptime/sensor.py index 90d2a9e34ec..a622835a0da 100644 --- a/homeassistant/components/uptime/sensor.py +++ b/homeassistant/components/uptime/sensor.py @@ -45,9 +45,10 @@ async def async_setup_platform( class UptimeSensor(SensorEntity): """Representation of an uptime sensor.""" + _attr_device_class = SensorDeviceClass.TIMESTAMP + _attr_should_poll = False + def __init__(self, name: str) -> None: """Initialize the uptime sensor.""" - self._attr_name: str = name - self._attr_device_class = SensorDeviceClass.TIMESTAMP - self._attr_should_poll: bool = False + self._attr_name = name self._attr_native_value = dt_util.utcnow()