Core: Unifi direct error, Unifi does not return list of connected clients

Created on 6 May 2020  路  6Comments  路  Source: home-assistant/core

The problem


Lots of errors are coming from the Ubiquiti UniFi AP component in my set up. Something is wrong in how the module operates.

image

It seems that the code logs into the UAP and processes the results of the mca-dump | tr -d "\n" command. I have 4 UAPs and dumped the JSON from each of them then tested the code used in the component. The following JSON output breaks the module.

{ "architecture": "mips", "board_rev": 17, "bootid": 1, "bootrom_version": "unifi-enlarge-buf.-1-g63fe9b5d-dirty", "cfgversion": "895fac54d8ea4d11", "connect_request_ip": "192.168.1.107", "connect_request_port": "36530", "default": false, "discovery_response": false, "dualboot": true, "hash_id": "019c47e264300b13", "hostname": "Garage", "inform_as_notif": true, "inform_url": "http://172.16.1.2:8080/inform", "ip": "192.168.1.107", "isolated": false, "kernel_version": "4.4.153", "locating": false, "mac": "78:8a:20:29:14:01", "manufacturer_id": 2, "model": "U7LR", "model_display": "UAP-AC-LR", "netmask": "255.255.255.0", "notif_payload": "", "notif_reason": "cmd", "required_version": "3.4.1", "selfrun_beacon": true, "serial": "788A20211111", "state": 2, "time": 1588757968, "time_ms": 2, "uptime": 9407959, "version": "4.0.80.10875"}

The module is expecting the command to return details of the connected devices. I suspect Unifi have issued a firmware update and this is no longer happening. Some of my devices return the correct data, some don't, so this change might be related to the hardware revision perhaps.

The effect of this is that the device tracker no longer works / is no longer reliable. At my home I use the device tracker in automatons which sometimes didn't fire. I suspect this is the case.

I'm not sure this component can be reliably fixed using the mca-dump command. At the very least raise a user readable error message at this point in the code https://github.com/home-assistant/core/blob/f1d3c0d19b4065a1f6ec80ecdc080380f728196c/homeassistant/components/unifi_direct/device_tracker.py#L126 if UNIFI_SSID_TABLE can't be found.

Environment

arch | armv7l
dev | false
docker | false
hassio | false
os_name | Linux
os_version | 4.19.97-v7+
python_version | 3.7.3
timezone | Europe/London
version | 0.109.4
virtualenv | true

Affected and Unaffected is the same: 4.0.80.10875

  • Home Assistant Core release with the issue:
    0.109.4
  • Last working Home Assistant Core release (if known):
    Unknown
  • Operating environment (Home Assistant/Supervised/Docker/venv):
    venv
  • Integration causing this issue:
    unifi_direct
  • Link to integration documentation on our website:
    https://www.home-assistant.io/integrations/unifi_direct/

Problem-relevant configuration.yaml

Traceback/Error logs

2020-05-06 10:15:45 ERROR (SyncWorker_1) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:16:06 ERROR (SyncWorker_12) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:16:06 ERROR (SyncWorker_7) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:16:27 ERROR (SyncWorker_0) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:16:48 ERROR (SyncWorker_5) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:17:09 ERROR (SyncWorker_12) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:17:09 ERROR (SyncWorker_2) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:17:09 ERROR (SyncWorker_11) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:17:51 ERROR (SyncWorker_3) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:18:54 ERROR (SyncWorker_18) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:18:54 ERROR (SyncWorker_14) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:18:54 ERROR (SyncWorker_3) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:19:15 ERROR (SyncWorker_13) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:19:36 ERROR (SyncWorker_15) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.
2020-05-06 10:19:36 ERROR (SyncWorker_8) [homeassistant.components.unifi_direct.device_tracker] Failed to decode response from AP.

Additional information

unifi_direct

Most helpful comment

I'm having this issue as well. From the comment on the closed PR above it sounds like this will not be fixed until the integration is re-built based on an external library? Such an external library doesn't seem to exist yet - all I can find interacts with the controller and not the APs themselves or am I missing something?
It seems harsh to favor a broken integration over a properly integrated one, though.

All 6 comments

Just wanted to say I'm having the same issue. I have a Unifi AP-AC-Pro access point and did recently update its firmware to: v4.3.13.11253 which seems to correspond with when I started to notice this error.

I continue to have this issue as well. Is there a code owner for this integration?

I am having the same problem with a UAP鈥慉C鈥慙ITE.

Logger: homeassistant.components.unifi_direct.device_tracker
Source: components/unifi_direct/device_tracker.py:57

Keeps showing up, but I don't use the integration ... What's happening?

I'm having this issue as well. From the comment on the closed PR above it sounds like this will not be fixed until the integration is re-built based on an external library? Such an external library doesn't seem to exist yet - all I can find interacts with the controller and not the APs themselves or am I missing something?
It seems harsh to favor a broken integration over a properly integrated one, though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flsabourin picture flsabourin  路  3Comments

Konstigt picture Konstigt  路  3Comments

piitaya picture piitaya  路  3Comments

sogeniusio picture sogeniusio  路  3Comments

ofuangka picture ofuangka  路  3Comments