Discover devices from device_trackers with router sources (#45160)
* Discover devices from device_trackers with router sources * Update homeassistant/components/dhcp/__init__.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * fix stop being called on the wrong context * clean * move it to base * cleanup was too agressive * Update homeassistant/components/dhcp/__init__.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * coverage * revert legacy changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
598a0d19b1
commit
5e01b828af
7 changed files with 393 additions and 68 deletions
|
@ -52,6 +52,7 @@ CLIENT_STATIC_ATTRIBUTES = [
|
|||
"oui",
|
||||
]
|
||||
|
||||
|
||||
CLIENT_CONNECTED_ALL_ATTRIBUTES = CLIENT_CONNECTED_ATTRIBUTES + CLIENT_STATIC_ATTRIBUTES
|
||||
|
||||
DEVICE_UPGRADED = (ACCESS_POINT_UPGRADED, GATEWAY_UPGRADED, SWITCH_UPGRADED)
|
||||
|
@ -239,6 +240,21 @@ class UniFiClientTracker(UniFiClient, ScannerEntity):
|
|||
|
||||
return attributes
|
||||
|
||||
@property
|
||||
def ip_address(self) -> str:
|
||||
"""Return the primary ip address of the device."""
|
||||
return self.client.raw.get("ip")
|
||||
|
||||
@property
|
||||
def mac_address(self) -> str:
|
||||
"""Return the mac address of the device."""
|
||||
return self.client.raw.get("mac")
|
||||
|
||||
@property
|
||||
def hostname(self) -> str:
|
||||
"""Return hostname of the device."""
|
||||
return self.client.raw.get("hostname")
|
||||
|
||||
async def options_updated(self) -> None:
|
||||
"""Config entry options are updated, remove entity if option is disabled."""
|
||||
if not self.controller.option_track_clients:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue