Home Assistant Community Add-on: UniFi Controller

Hoi, question.

I’m running the UniFi Integration for a while now, therefore the normal configuration,yaml setting and had a lot of 10 seconds warnings within my Home Assistant for lots of devices/plugins/addons, so not only unifi.

Yesterday I’ve cleaned my config, so a lot is being excluded in recorder:, the bluetooth device tracker is disabled, etc, etc to minimize the 10 second shizzle, what worked for most of my problems!

But, I still struggle with the UniFi Integration, it seems I cannot get it to work reliable for my (only 2!) devices to see if they’re at home or not.

Regularly I get there log entries in HA:

Unable to reach controller tcc.bla.bla
2:25 components/unifi/controller.py (ERROR)

Update of device_tracker.apple_iphone_xr_jose is taking over 10 seconds
2:25 main.py (WARNING)

Update of device_tracker.apple_iphone_xr_richard is taking over 10 seconds
2:25 main.py (WARNING)

And the problem with that is HA sets those 2 devices from home to not available/niet beschikbaar for 1 minute and after that back to home again.

I cannot automate things with that behaviour anymore. In the settings the the time to set them as away is 180 seconds.

But that seems to work because HA never sets those devices as not_home, everytime I get the "unable to reach controller " it sets them to unavailable.

Is this al HA thing, of can that be fixed within your code?

Thanks man.

ps. using the iPhone Mobile App since the last version as well for presence detection, that is reliable, but not useful for everything because it reports me as home for example when I visit my neighbour and disconnect my own wifi :wink:

O maybe it is useable for presence after all, because the devices never set to not_home during the “timeout” I guess.

But still can’t see how long devices are at home because the home state/time gets reset if it happens :slight_smile:

Hope to get a reply tho, thanks again!

Hi all,
i moved my hyper-v hass.io to an esxi vm, (fresh install + snapshot restore), can’t add unifi integration, I always get service not available.
Any suggestions?
Thanks all!

:tada: Release v0.13.4

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :fireworks: Updates maintenance/license year to 2020
  • :pencil2: Funding adjustments
  • :pencil2: Fixes some spelling and grammar
  • :books: Adjust add-on installation instructions
  • :arrow_up: Upgrades add-on base image to v4.0.3
  • :arrow_up: Upgrades openjdk-8-jdk-headless to 8u232-b09-0ubuntu1~18.04.1

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

2 Likes

Thanks. I previously had the hostname as my duckdns hostname, and didn’t have override checked. Toggling override inform host by itself did not fix the adopting loop my switch was in, but switching to my hostname/IP to the IP (instead of duckdns hostname) and toggling override inform host worked.

Anybody ever had this happen? Fresh install of Hass on a fresh SD card, everything else working, but this add-on won’t start?

Error: Invalid or corrupt jarfile /usr/lib/unifi/lib/ace.jar
[21:34:12] INFO: Starting the UniFi Controller...
Error: Invalid or corrupt jarfile /usr/lib/unifi/lib/ace.jar
[21:34:15] INFO: Starting the UniFi Controller...
Error: Invalid or corrupt jarfile /usr/lib/unifi/lib/ace.jar

EDIT Got round that problem by reinstalling the add-on. Now trying to restore from a backup and new errors:

OpenJDK Client VM warning: You have loaded library /usr/lib/unifi/lib/native/Linux/armv7/libubnt_webrtc_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
Exception in thread "Thread-14" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Initialization of bean failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
	at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1455)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1310)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
	at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:802)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:143)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1143)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
	at org.springframework.context.support.DefaultLifecycleProcessor.getLifecycleBeans(DefaultLifecycleProcessor.java:289)
	at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:195)
	at org.springframework.context.support.DefaultLifecycleProcessor.stop(DefaultLifecycleProcessor.java:116)
	at org.springframework.context.support.AbstractApplicationContext.stop(AbstractApplicationContext.java:1331)
	at com.ubnt.service.B.oÓ0000(Unknown Source)
	at com.ubnt.ace.Launcher$2.run(Unknown Source)
Caused by: 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:177)
	at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1212)
	at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:340)
	at org.springframework.web.servlet.handler.AbstractHandlerMapping.detectMappedInterceptors(AbstractHandlerMapping.java:318)
	at org.springframework.web.servlet.handler.AbstractHandlerMapping.initApplicationContext(AbstractHandlerMapping.java:293)
	at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:124)
	at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:77)
	at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:78)
	at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:120)
	at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:96)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1737)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
	... 45 more

Did you ever resolve this issue? I’ve created a github issue

:tada: Release v0.13.5

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :arrow_up: Upgrades openjdk-8-jdk-headless to 8u242-b08-0ubuntu3~18.04

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

1 Like

Hi,

I have had a problem for a week on my unifi controller.
When I activate the SSL mode, the controller does not start. Without SSL mode, it starts but is only accessible via unifi.ui.com

Here’s the log

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: UniFi Controller
 Manage your UniFi network using a web browser
-----------------------------------------------------------
 Add-on version: 0.13.5
 You are running the latest version of this add-on.
 System: HassOS 3.8  (armv7 / raspberrypi3)
 Home Assistant version: 0.104.3
 Supervisor version: 195
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] unifi.sh: executing... 
[23:07:58] DEBUG: Injecting SSL certificate into the controller...
[23:07:58] DEBUG: Preparing certificate in a format UniFi accepts...
[23:07:58] DEBUG: Removing existing certificate from UniFi protected keystore...
keytool error: java.lang.Exception: Alias <unifi> does not exist
[cont-init.d] unifi.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Has anyone ever had the problem?

Thanks :slight_smile:

I faced the same problem with the backup/restore function.
In my case I used the switch site option to switch my AP from another controller to this installation.

Hi - firstly, thanks for the plugin. I recently moved over to hassio and this has been working well, but (and you probably knew this was coming!) the latest hassio update may (it could always be an issue specific to my configuration) have introduced an issue where the plugin does not start. Everything seems to fire up normally, with the last message in the log stating “Starting the UniFi Controller…”, but (for me) the web gui doesn’t fire up. I’ve been running without a certificate, so when I get a chance I might set one up and see if that makes a difference, as well as dig deeper around the hassio logs to see if anything obvious is in there.

Add-on version: 0.13.5
System: HassOS 3.10 (armv7 / raspberrypi3)
Home Assistant version: 0.105.4
Supervisor version: 200

At the moment I’m not actually minded to try to work around the bug because my HA instance still seems able to detect devices coming and going on the network despite lack of a working controller! Surprising to me.

:tada: Release v0.14.0

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :books: Update add-on documentation to use new YAML configuration format
  • :hammer: Re-branding
  • :hammer: Update add-on config with new password & list features
  • :arrow_up: Upgrades add-on base image to v5.0.1
  • :hammer: Update community forum links
  • :books: Documentation tweaks

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

1 Like

Hi guys, I have exactly the same problem.
I was able to configure the first time I installed. and now (after a while) I got this :
Alias does not exist
Any help or suggestions (Log in debug mode doesn’t help.

Any support is appreciated.

```
Add-on version: 0.14.0

  • You are running the latest version of this add-on.*

  • System: HassOS 3.11 (aarch64 / raspberrypi3-64)*

  • Home Assistant Core: 0.106.2*

  • Home Assistant Supervisor: 201*
    [cont-init.d] 00-banner.sh: exited 0.
    *[cont-init.d] 01-log-level.sh: executing… *
    Log level is set to DEBUG
    [cont-init.d] 01-log-level.sh: exited 0.
    *[cont-init.d] unifi.sh: executing… *
    [11:36:31] DEBUG: Injecting SSL certificate into the controller…
    [11:36:31] DEBUG: Preparing certificate in a format UniFi accepts…
    [11:36:31] DEBUG: Removing existing certificate from UniFi protected keystore…
    keytool error: java.lang.Exception: Alias does not exist
    [cont-init.d] unifi.sh: exited 1.
    [cont-finish.d] executing container finish scripts…
    *[cont-finish.d] 99-message.sh: executing… *
    -----------------------------------------------------------

  •            Oops! Something went wrong.*
    
  • We are so sorry, but something went terribly wrong when*

  • starting or running this add-on.*

  • Be sure to check the log above, line by line, for hints.*
    -----------------------------------------------------------
    [cont-finish.d] 99-message.sh: exited 0.
    [cont-finish.d] done.
    [s6-finish] waiting for services.
    [s6-finish] sending all processes the TERM signal.
    ```

Hi, solved by myself.
put ssl =false -> means that unify use a selfsigned certificate but is still a HTTPS:// request.
I was confused ad tried with http://
then after confirmation that the backup file was in place in /backup/unifi i reinstalled the plugin.
services started (again the log confused me: message is_ Unify starting and not started so in not clear the real service status).
at the first login, I chose the restore from backup. in addition, I changed the controller name in the unify controller setting with the same name as the hassio node.
Now all is working again as before.

1 Like

Is anyone else having the problem of the USG and AP forgetting their inform address?

I find myself regurarly fixing the inform address for the units because they revert back to http://unifi:8080/inform instead of http://192.168.x.xxx:8080/inform

I find it usually happening when I restart my HA

I don’t know if this is related, but it’s the only error I’m getting on the plugin logs

OpenJDK Client VM warning: You have loaded library /usr/lib/unifi/lib/native/Linux/armv7/libubnt_webrtc_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.

just in case anyone else runs into the problem of devices (APs) not being found.

I had 2 AP-AC-Lites running that I had set up in standalone mode using the mobile app and they wouldn’t appear in the controller. I assumed it was something to do with my controller settings, but after a lot of hair pulling, I figured out they needed a full factory reset (not just a press of the reset button on the back).

To do this I SSH into the AP (ssh username-set-up-in-mobile-app@ip-of-AP
then I used the command “syswrapper.sh restore-default” to reset the AP.
The devices reset and then were discovered by the controller.

Hope this helps others

1 Like

I must be doing something wrong. I used to SSH into my cloud key all the time, however I have since migrated to the HASSIO plugin and cannot figure out how to get to it using putty on another computer. I tried hitting the HASSIO IP however I am guessing that is not working because Unifi runs in a docker container and has a different IP. any help would be much appreciated. thanks.

Hello,
How does the upgrade process working ?
Currently it is on 5.12.35 but now is 5.12.66 out.
Can we upgrade the Controller manually or not ?
Thanks !
Regards,
Bart

Bart, if you are using the Hassio addon, in the addon details (Supervisor -> select UniFi addon) you will be able to do that.