mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-09 17:04:29 +02:00
merged get_sfp into path
This commit is contained in:
parent
8efaa72492
commit
7782503f78
2 changed files with 10 additions and 34 deletions
|
@ -344,38 +344,6 @@ class MikrotikAPI:
|
|||
self.lock.release()
|
||||
return True
|
||||
|
||||
# ---------------------------
|
||||
# get_sfp
|
||||
# ---------------------------
|
||||
def get_sfp(self, interfaces) -> Optional(list):
|
||||
"""Get sfp info"""
|
||||
if not self.connection_check():
|
||||
return None
|
||||
|
||||
response = self.path("/interface/ethernet", return_list=False)
|
||||
if response is None:
|
||||
return None
|
||||
|
||||
args = {".id": interfaces, "once": True}
|
||||
self.lock.acquire()
|
||||
try:
|
||||
_LOGGER.debug("API query: %s %s", "/interface/ethernet/monitor", interfaces)
|
||||
sfpinfo = response("monitor", **args)
|
||||
except Exception as e:
|
||||
self.disconnect("get_sfp", e)
|
||||
self.lock.release()
|
||||
return None
|
||||
|
||||
try:
|
||||
sfpinfo = list(sfpinfo)
|
||||
except Exception as e:
|
||||
self.disconnect("get_sfp", e)
|
||||
self.lock.release()
|
||||
return None
|
||||
|
||||
self.lock.release()
|
||||
return sfpinfo or None
|
||||
|
||||
# ---------------------------
|
||||
# arp_ping
|
||||
# ---------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue