Home Assistant Community Add-on: UniFi Controller

I have an ancient neglected but working install of the Unifi Controller (addon version 0.18.1). I’m trying to migrate/upgrade but am running into problems. I’d like to avoid having to start over from scratch.

(The reason it is such an old installation is because it was originally installed on an RPI with a 32 bit OS so the version got stuck after updates were only for 64 bit OS. Currently I’ve got 0.18.1 running controller version 5.14.23 on an x86_64 VirtualBox VM, supervisor 2024.03.0, core is 2024.2.5.)

The first thing I’m trying to figure out is where are the logs?

I’ve got log-level set to debug. I’m not seeing anything beyond the start up info in the addon logs.

In the controller/site page, I’ve got remote syslog enabled, but I’m only getting syslog messages from the APs and not the controller.

If I docker exec to shell inside the addon container, I don’t see any obvious log files.

Thanks in advance for any help.


EDIT/UPDATE - I did finally see by using journalctl on the HaOS host that mongodb was dumping core as a result of a SIGABRT (6) during process of restoring a Unifi 90 day manual backup from my 0.18.1 install to a fresh 3.0.3 install on another VirtualBox VM.

Mar 16 19:40:06 hasstst audit[34158]: ANOM_ABEND auid=4294967295 uid=0 gid=0 ses=4294967295 subj=docker-default pid=34158 comm="conn2" exe="/usr/bin/mongod" sig=6 res=1
Mar 16 19:40:06 hasstst kernel: audit: type=1701 audit(1710618006.104:1370): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=docker-default pid=34158 comm="conn2" exe="/usr/bin/mongod" sig=6 res=1
Mar 16 19:40:06 hasstst systemd-coredump[34460]: Process 34158 (mongod) of user 0 dumped core.
Mar 16 19:40:06 hasstst systemd[1]: [email protected]: Deactivated successfully.

EDIT/UPDATE - I haven’t found how to get more logging from the Java process, though I have occasionally seen a message in the addon log when the Java process dies.

However the log for MongoDB is inside the container /var/log/unifi/mongod.log. Have gotten some clues looking at that file.

EDIT/UPDATE - I did successfully get the controller addon moved and upgraded.

  • Trying to use an addon backup to move/copy the existing 0.18.1 install to a test Home Assistant instance in order to try to do a test upgrade there failed. While Supervisor did install the 0.18.1 container there was something wrong that prevented the web app from starting/deploying correctly. I couldn’t find any clues as to why. (My guess is the changes to supervisor/addon file locations since the 0.18.1 addon might be a cause.)

  • Doing a unifi app backup from 0.18.1 and restoring to a fresh 3.0.3 install eventually worked. I had to limit the number of days of history in the backup or mongodb would crash (SIGABORT) doing the restore. I don’t know if that is due to running out of memory or there is corruption in my original database. I did wind up bumping the addon’s optional setting for max memory that set Java’s max memory to 2GB. But that only affects the Unifi web app, not necessarily Mongod.

I did get an exception thrown from Java as it was completely the restore, but it seemed to work fine after that:

org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
Exception in thread "Thread-8" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
	at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:168)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1172)
	at com.ubnt.service.C.Ö00000(Unknown Source)
	at com.ubnt.ace.Launcher.Ö00000(Unknown Source)
	at java.base/java.lang.Thread.run(Thread.java:840)

Hi guys,
I’ve just installed this add on but it can’t find any of my devices. I think it’s because the controller is coming up with an IP address that isn’t the IP address of my install on the Pi, and it seems to be on a completely different network (172… for the controller, everything on my network is 192.168…).
Running ifconfig shows the 172 address seems to be associated with a hassio device.
Is this the issue and where on earth do I change it?
Thank you all.

Has anyone figured out how to change the SSL certificate used by the GUI? I have an internal CA, and issued certificate for my UniFi Addon, but can not figure out how to change the certificate. Everything I see online says to SSH into the UniFi controller, and update the certificate throught there, but I suspect I would have to map a port into the docker container for the ssh connection (i.e.- 8822 → 22). Any insights would be greatly appriciated.

If I recall right, you should SSH into HAOS or use the terminal addon and from there you use a docker command to go into the docker container for Unifi. I do think each update will undo this though, so be aware that you should know what you are doing.

I ended up overriding the default inform url to change it to the correct IP address. Same issue with me and the 172 ip!

Settings > System > Advanced > Inform Host

Tick the override tickbox and pop your IP in. Once the unifi devices adopt it’ll use the right controller IP then, good luck!

Cheers, Mike

Unifi device tracker - how do I remove old Entities from the list?

I get a lot of laptops added to my WIFi for a few days, and then gone. The Unifi device tracker is keeping these in a list.

When I go into the Unifi Addon and look at the Entities I have many listed as device_tracker.unifi_default_12_34_55_aa_bb_cc which I would like to delete.

I look at the entity and the DELETE option is greyed out. They are “disabled”. Enabling them does not seem to help me delete them.

Where are these listed and how can I purge them? A restart of HA does not purge them as many of these are older than my last HA restart.

They would be in a file called known_devices.yaml. Remove the entries from there and they should dissapear.

1 Like

The only items in known_devices.yaml are ones I added. Which are a different set of devices using different variations of names than the ones Unifi comes up with.

Since posting this question I have updated both the Unifi addon and the HASOS, requiring restarts of HA, and still they persist. Long after the devices have left the building, never to return… :thinking:

Where is the known_devices.yaml that you are referring too?
/config/known_devices.yaml

Hmm… In my case the unknowns are in the known_devices.yaml (indeed in the config folder):

image

in known_devices:
image

Removing and restarting HA will take them out of the list.

Strange… I’ve never seen anything else write to that file. Only the half dozen things I manually added, yet dozens of items are listed by Unifi.

I’m reading this using Studio Code Server. Which is where I also make my manual changes to that file.

Started hacking around via command line and found /root/config/.storage/core.entity_registry which is clearly a system file. They are all listed in there. But not something I am planning to start editing when I don’t know what it is.

This is also a /root/config/unifi_data that seems to include the duff items.

I got to carefully compare some of these MAC addresses in those lists to see if I can see a pattern. Still not really something I should be touching though as I’d expect to trim this in the GUI somewhere.

Wait… now that I think of it… I´m mixing 2 things:

  1. The client devices you see in the application. This is in the Unifi Add-on, network application (stored in the Add-on docker). This has nothing to do with Home assistant and thus neither known_devices.yaml. If you wonder how to remove these, you need to ask in the Unifi forum.
  2. I use separately the unifi_direct integration to see if anyone is at home and have the devices appear in Home assistant. This writes the entries in the known devices file.

Now I am totally lost. My UniFi controller I thought could only see stuff on the UniFi network. Which in my case is WiFi kit. One Ubiquiti AP with a small number of attached devices (phones, printers, laptop) and lots of visitors.

I have an EdgeOS router that doesn’t talk to the UniFi Controller that sees all the ethernet items. (Different HA addon to handle that)

Most of these odd items are listed as device_tracker.unifi_default_12_34_55_aa_bb_cc and that unifi in the name made me assume it was from this addon. And by looking at /root/config/unifi_data seems to confirm that is the case. That list of “wireless_clients” way too long… it seems to be remembering everything that has visited. I want to tell it to forget.

I can’t see this list in the actual Unifi network dashboard. And attempting to interact with those items in the Unifi HA addon tells me they are disabled. These items that are “disabled” I want to delete.

Try this …

Thanks. That service looks promising… but I may need to change the definition of “short period of time”. These devices are usually around a day or three. Ideally once it has gone AWOL for a week I’d like to drop it. Or manually remove.

Running that service did not change the list of disabled items for me.

This requires the Unifi Network integration ( UniFi Network - Home Assistant (home-assistant.io)). Something I have not added as it states it conflicts with MQTT which I use for my Zigbee network integration (Zigbee2MQTT)

I already have the Unifi Network Integration. It is what I am talking about. The bit that integrates with the controller. Am I posting in the wrong thread?

I think you’ll find it works perfectly. That’s been my setup for 4 years and I’ve had zero issues. (as in Unifi Network, Z2M and MQTT).

1 Like

That’s the same UniFi Network Application Add-on icon I have. But also think I may be in the wrong thread. Trying to read through this now as I see someone with similar issues of entities that won’t go away. Just a long way to read to find if they ever found a solution… :grin:
-=-=-
After a lot of reading that thread, and experimenting the solution to delete my dead entities is: Enable each duff entity in the Entities list. Then restart HA. Now manually delete each entity…

Thanks to the new multi-select on the entities list it is fairly quick to enable them all and delete en-masse. After a few restarts.

Spoke too soon… still stuck with three that don’t wanna go… but certainly better than the 50 I had.

Hi
I just installed this addon and migrated my settings from Docker instance. All working BUT automatic backups don’t work. They are set to run but I find no backups in /backup/unifi. Manual backups via download are fine.
What could be wrong?

How do you users of this addon safeguard the backups that are being made in the /backup/unifi folder? I would like to save them at another location in case I want to nuke the HA installation.

TIA