mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-24 17:58:47 +02:00
refactoring
This commit is contained in:
parent
968d5c3859
commit
f8b8dd075b
2 changed files with 4 additions and 10 deletions
|
@ -73,10 +73,7 @@ def from_entry_bool(entry, param, default=False, reverse=False) -> bool:
|
|||
if not isinstance(ret, bool):
|
||||
ret = default
|
||||
|
||||
if reverse:
|
||||
return not ret
|
||||
|
||||
return ret
|
||||
return not ret if reverse else ret
|
||||
|
||||
|
||||
# ---------------------------
|
||||
|
|
|
@ -110,14 +110,11 @@ class MikrotikHostDeviceTracker(MikrotikDeviceTracker):
|
|||
if self._data["source"] in ["capsman", "wireless"]:
|
||||
return self._data[self.entity_description.data_attribute]
|
||||
|
||||
if (
|
||||
return bool(
|
||||
self._data["last-seen"]
|
||||
and (utcnow() - self._data["last-seen"])
|
||||
and utcnow() - self._data["last-seen"]
|
||||
< self.option_track_network_hosts_timeout
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
)
|
||||
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue