Skip to content

Commit

Permalink
Use shorthand attributes in Keenetic (home-assistant#99577)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Sep 4, 2023
1 parent 6194f7f commit d5301fb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions homeassistant/components/keenetic_ndms2/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,14 @@ class RouterOnlineBinarySensor(BinarySensorEntity):
def __init__(self, router: KeeneticRouter) -> None:
"""Initialize the APCUPSd binary device."""
self._router = router

@property
def unique_id(self) -> str:
"""Return a unique identifier for this device."""
return f"online_{self._router.config_entry.entry_id}"
self._attr_unique_id = f"online_{router.config_entry.entry_id}"
self._attr_device_info = router.device_info

@property
def is_on(self):
"""Return true if the UPS is online, else false."""
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:
"""Client entity created."""
self.async_on_remove(
Expand Down

0 comments on commit d5301fb

Please sign in to comment.