From e0a8ec4f62afef83e015f470bd7348c34bbbdccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 17 Aug 2021 08:30:35 +0200 Subject: [PATCH] Add device class update to the updater binary_sensor (#54732) --- .../components/updater/binary_sensor.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/updater/binary_sensor.py b/homeassistant/components/updater/binary_sensor.py index 1c6bacede62..25339f6308a 100644 --- a/homeassistant/components/updater/binary_sensor.py +++ b/homeassistant/components/updater/binary_sensor.py @@ -1,7 +1,10 @@ """Support for Home Assistant Updater binary sensors.""" from __future__ import annotations -from homeassistant.components.binary_sensor import BinarySensorEntity +from homeassistant.components.binary_sensor import ( + DEVICE_CLASS_UPDATE, + BinarySensorEntity, +) from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import ATTR_NEWEST_VERSION, ATTR_RELEASE_NOTES, DOMAIN as UPDATER_DOMAIN @@ -18,15 +21,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class UpdaterBinary(CoordinatorEntity, BinarySensorEntity): """Representation of an updater binary sensor.""" - @property - def name(self) -> str: - """Return the name of the binary sensor, if any.""" - return "Updater" - - @property - def unique_id(self) -> str: - """Return a unique ID.""" - return "updater" + _attr_device_class = DEVICE_CLASS_UPDATE + _attr_name = "Updater" + _attr_unique_id = "updater" @property def is_on(self) -> bool | None: