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):
|
if not isinstance(ret, bool):
|
||||||
ret = default
|
ret = default
|
||||||
|
|
||||||
if reverse:
|
return not ret if reverse else ret
|
||||||
return not ret
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|
|
@ -110,14 +110,11 @@ class MikrotikHostDeviceTracker(MikrotikDeviceTracker):
|
||||||
if self._data["source"] in ["capsman", "wireless"]:
|
if self._data["source"] in ["capsman", "wireless"]:
|
||||||
return self._data[self.entity_description.data_attribute]
|
return self._data[self.entity_description.data_attribute]
|
||||||
|
|
||||||
if (
|
return bool(
|
||||||
self._data["last-seen"]
|
self._data["last-seen"]
|
||||||
and (utcnow() - self._data["last-seen"])
|
and utcnow() - self._data["last-seen"]
|
||||||
< self.option_track_network_hosts_timeout
|
< self.option_track_network_hosts_timeout
|
||||||
):
|
)
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self) -> str:
|
def icon(self) -> str:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue