Unifi Device Tracker

I was until recently using the unifi_direct method of device tracking to send push notifications for newly arrived guests. This was working well. The Unifi controller is a Hass add-on.

At some point something seems to have stopped working without my having touched the settings - I’ve used the ‘dev state’ page to trigger a device_tracker to home from not_home and I get the push notification instantly so it seems it’s not my config YAML but something going wrong between my Unifi AP or the controller passing the information to HASS that devices have arrived.

Looking at my logs, I’m seeing the following:-

2018-12-18 22:04:46 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform unifi_direct
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 176, in async_setup_platform
    platform.get_scanner, hass, {DOMAIN: p_config})
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/unifi_direct.py", line 38, in get_scanner
    scanner = UnifiDeviceScanner(config[DOMAIN])
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/unifi_direct.py", line 56, in __init__
    self._connect()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/unifi_direct.py", line 81, in _connect
    password=self.password, port=self.port)
  File "/usr/local/lib/python3.6/site-packages/pexpect/pxssh.py", line 434, in login
    self.before, self.PROMPT,))
pexpect.pxssh.ExceptionPxssh: could not set shell prompt (received: b"unset PROMPT_COMMAND\r\nPS1='[PEXPECT]\\$ '\r\nset prompt='[PEXPECT]\\$ '\r\n", expected: '\\[PEXPECT\\][\\$\\#] ').

Any ideas why this error has suddenly appeared and how I can get rid of it?!

Thanks!!

I would delete this, but I don’t have permission to do so! But basically I found my issue: my AP had changed IP. Stupid eh?

Anyone know how to get (for example) a pushover notification if HA is struggling to connect? Would be good to get a heads up asap. (I have now set a static IP for the AP on my router)

You could use a ping sensor pointed at the IP you think it should be, and trigger a notification based on the sensor turning off if the IP changes.