mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-29 20:14:30 +02:00
fixes and code cleanup
This commit is contained in:
parent
e439a4062e
commit
6b2f9ae4e2
5 changed files with 58 additions and 60 deletions
|
@ -98,7 +98,7 @@ class MikrotikAPI:
|
|||
self.error = "cannot_connect"
|
||||
if error == "invalid user name or password (6)":
|
||||
self.error = "wrong_login"
|
||||
|
||||
|
||||
if "ALERT_HANDSHAKE_FAILURE" in error:
|
||||
self.error = "ssl_handshake_failure"
|
||||
|
||||
|
@ -122,7 +122,7 @@ class MikrotikAPI:
|
|||
|
||||
try:
|
||||
response = self._connection.path(path)
|
||||
_LOGGER.debug("API response ({}): {}".format(path, tuple(response)))
|
||||
_LOGGER.debug("API response (%s): %s", path, tuple(response))
|
||||
except librouteros_custom.exceptions.ConnectionClosed:
|
||||
_LOGGER.error("Mikrotik %s connection closed", self._host)
|
||||
self._connected = False
|
||||
|
@ -247,11 +247,11 @@ class MikrotikAPI:
|
|||
response = self.path('/interface')
|
||||
if response is None:
|
||||
return None
|
||||
|
||||
|
||||
args = {'interface': interfaces, 'once': True}
|
||||
try:
|
||||
traffic = response('monitor-traffic', **args)
|
||||
_LOGGER.debug("API response ({}): {}".format("/interface/monitor-traffic", tuple(response)))
|
||||
_LOGGER.debug("API response (%s): %s", "/interface/monitor-traffic", tuple(response))
|
||||
except librouteros_custom.exceptions.ConnectionClosed:
|
||||
_LOGGER.error("Mikrotik %s connection closed", self._host)
|
||||
self._connected = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue