question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:40 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
dschanoehcommented, Jul 16, 2020

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.

4reactions
robevingcommented, Jan 13, 2021

FFS, is this the fix? Someone bothered to go out of their way to fix it and it wasn’t applied!

What a waste of everyone’s time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing clients in unifi controller - Ubiquiti Community
Solved it for me: Go to Settings and disable New User Interface. Then go to Insights, select Client History and All. My missing...
Read more >
UniFi Network - Home Assistant
Items in this list will have a Home Assistant switch created, using the UniFi Device name, allowing for blocking and unblocking. Control clients...
Read more >
unifi usg firmware - Ristorante Liberty Sassari
190902)My home network is all Ubiquiti, but I was running a Cloud Key Gen 2 Plus ... ERROR (2,282) How To Block/Unblock Wireless...
Read more >
UniFi Cloud Key UCK-G2 Quick Start Guide - Ubiquiti
If power is not restored within 10 seconds, the device will safely shutdown. Slow. Flashing. Client connected to device via. Bluetooth (BLE). Off/White/....
Read more >
Can I monitor Ubiquiti UniFi network devices with PRTG?
The sensor will not produce any alerts by default, unless it is unable to authenticate or contact the UniFi controller. Once the sensor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found