mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Use shorthand attributes in Keenetic (#99577)
This commit is contained in:
parent
6194f7faea
commit
d5301fba90
@ -33,22 +33,14 @@ class RouterOnlineBinarySensor(BinarySensorEntity):
|
|||||||
def __init__(self, router: KeeneticRouter) -> None:
|
def __init__(self, router: KeeneticRouter) -> None:
|
||||||
"""Initialize the APCUPSd binary device."""
|
"""Initialize the APCUPSd binary device."""
|
||||||
self._router = router
|
self._router = router
|
||||||
|
self._attr_unique_id = f"online_{router.config_entry.entry_id}"
|
||||||
@property
|
self._attr_device_info = router.device_info
|
||||||
def unique_id(self) -> str:
|
|
||||||
"""Return a unique identifier for this device."""
|
|
||||||
return f"online_{self._router.config_entry.entry_id}"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if the UPS is online, else false."""
|
"""Return true if the UPS is online, else false."""
|
||||||
return self._router.available
|
return self._router.available
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self):
|
|
||||||
"""Return a client description for device registry."""
|
|
||||||
return self._router.device_info
|
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Client entity created."""
|
"""Client entity created."""
|
||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user