UniFi - Additional consolidation for cleanliness sake (#35395)

* Some additional consolidation for cleanliness sake

* Remove unnecessary mac property
This commit is contained in:
Robert Svensson 2020-05-09 00:34:18 +02:00 committed by GitHub
parent 953adc105e
commit b62c7abc5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 46 deletions

View file

@ -14,25 +14,14 @@ class UniFiClient(UniFiBase):
def __init__(self, client, controller) -> None:
"""Set up client."""
self.client = client
super().__init__(controller)
super().__init__(client, controller)
self._is_wired = self.client.mac not in controller.wireless_clients
self._is_wired = client.mac not in controller.wireless_clients
@property
def mac(self):
"""Return MAC of client."""
return self.client.mac
async def async_added_to_hass(self) -> None:
"""Client entity created."""
await super().async_added_to_hass()
self.client.register_callback(self.async_update_callback)
async def async_will_remove_from_hass(self) -> None:
"""Disconnect client object when removed."""
self.client.remove_callback(self.async_update_callback)
await super().async_will_remove_from_hass()
def client(self):
"""Wrap item."""
return self._item
@property
def is_wired(self):