mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Add device class update to the updater binary_sensor (#54732)
This commit is contained in:
parent
476f3b5cb5
commit
e0a8ec4f62
@ -1,7 +1,10 @@
|
|||||||
"""Support for Home Assistant Updater binary sensors."""
|
"""Support for Home Assistant Updater binary sensors."""
|
||||||
from __future__ import annotations
|
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 homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import ATTR_NEWEST_VERSION, ATTR_RELEASE_NOTES, DOMAIN as UPDATER_DOMAIN
|
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):
|
class UpdaterBinary(CoordinatorEntity, BinarySensorEntity):
|
||||||
"""Representation of an updater binary sensor."""
|
"""Representation of an updater binary sensor."""
|
||||||
|
|
||||||
@property
|
_attr_device_class = DEVICE_CLASS_UPDATE
|
||||||
def name(self) -> str:
|
_attr_name = "Updater"
|
||||||
"""Return the name of the binary sensor, if any."""
|
_attr_unique_id = "updater"
|
||||||
return "Updater"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self) -> str:
|
|
||||||
"""Return a unique ID."""
|
|
||||||
return "updater"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool | None:
|
def is_on(self) -> bool | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user