mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-29 22:19:37 +02:00
switched to standard ping
This commit is contained in:
parent
919c5022e8
commit
5aa6652301
1 changed files with 4 additions and 2 deletions
|
@ -435,7 +435,7 @@ class MikrotikAPI:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
"arp-ping": "yes",
|
"arp-ping": "no",
|
||||||
"interval": "100ms",
|
"interval": "100ms",
|
||||||
"count": 3,
|
"count": 3,
|
||||||
"interface": interface,
|
"interface": interface,
|
||||||
|
@ -443,7 +443,7 @@ class MikrotikAPI:
|
||||||
}
|
}
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
_LOGGER.debug("Ping host query: %s", "/ping")
|
# _LOGGER.debug("Ping host query: %s", args["address"])
|
||||||
ping = response("/ping", **args)
|
ping = response("/ping", **args)
|
||||||
except librouteros.exceptions.ConnectionClosed:
|
except librouteros.exceptions.ConnectionClosed:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
@ -485,8 +485,10 @@ class MikrotikAPI:
|
||||||
|
|
||||||
for tmp in ping:
|
for tmp in ping:
|
||||||
if "received" in tmp and tmp["received"] > 0:
|
if "received" in tmp and tmp["received"] > 0:
|
||||||
|
_LOGGER.debug("Ping host success: %s", args["address"])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
_LOGGER.debug("Ping host failure: %s", args["address"])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue