mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Fix Unifi direct errors caused by AP reboot. (#11835)
* Fix Unifi direct errors caused by AP reboot. * Inverted logic in update
This commit is contained in:
parent
1a789a05db
commit
6a6ea263cf
@ -98,11 +98,15 @@ class UnifiDeviceScanner(DeviceScanner):
|
|||||||
self.connected = False
|
self.connected = False
|
||||||
|
|
||||||
def _get_update(self):
|
def _get_update(self):
|
||||||
from pexpect import pxssh
|
from pexpect import pxssh, exceptions
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
self._connect()
|
self._connect()
|
||||||
|
# If we still aren't connected at this point
|
||||||
|
# don't try to send anything to the AP.
|
||||||
|
if not self.connected:
|
||||||
|
return None
|
||||||
self.ssh.sendline(UNIFI_COMMAND)
|
self.ssh.sendline(UNIFI_COMMAND)
|
||||||
self.ssh.prompt()
|
self.ssh.prompt()
|
||||||
return self.ssh.before
|
return self.ssh.before
|
||||||
@ -110,7 +114,7 @@ class UnifiDeviceScanner(DeviceScanner):
|
|||||||
_LOGGER.error("Unexpected SSH error: %s", str(err))
|
_LOGGER.error("Unexpected SSH error: %s", str(err))
|
||||||
self._disconnect()
|
self._disconnect()
|
||||||
return None
|
return None
|
||||||
except AssertionError as err:
|
except (AssertionError, exceptions.EOF) as err:
|
||||||
_LOGGER.error("Connection to AP unavailable: %s", str(err))
|
_LOGGER.error("Connection to AP unavailable: %s", str(err))
|
||||||
self._disconnect()
|
self._disconnect()
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user