Make the device_tracker more forgiving when passed an empty ip address string (#91101)
This has come up over and over and over again fixes #87165 fixes #51980
This commit is contained in:
parent
69f751703b
commit
5f0d983df1
2 changed files with 38 additions and 19 deletions
|
@ -348,7 +348,7 @@ class ScannerEntity(BaseTrackerEntity):
|
|||
self.mac_address,
|
||||
self.unique_id,
|
||||
)
|
||||
if self.is_connected:
|
||||
if self.is_connected and self.ip_address:
|
||||
_async_connected_device_registered(
|
||||
hass,
|
||||
self.mac_address,
|
||||
|
@ -405,7 +405,7 @@ class ScannerEntity(BaseTrackerEntity):
|
|||
"""Return the device state attributes."""
|
||||
attr: dict[str, StateType] = {}
|
||||
attr.update(super().state_attributes)
|
||||
if self.ip_address is not None:
|
||||
if self.ip_address:
|
||||
attr[ATTR_IP] = self.ip_address
|
||||
if self.mac_address is not None:
|
||||
attr[ATTR_MAC] = self.mac_address
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue