So it turns out the built-in getConfig().as(...) calls access the fields directly via reflection instead of calling the setters. As a result, the setter in my client config class was never getting called.

I've pushed an update to the binding to make use of a tidy() function to clean the config values and hence make MAC address comparisons case-insensitive.

If you don't mind, please update your binding and try again with your original MAC addresses and report back if this fixed your issue.

@mgbowman One thing I noticed, and this is pretty minor... I had my cable modem disconnected for a few minutes in order to reroute some cables. Noticed these log messages.

Note that this is the configuration where the Unifi Controller is on the other end of an IPSEC tunnel from the openHAB instance.

Wondering why it switched from the WARN to the ERROR level log message. Possibly the connection attempt failed on the WARN, and the DNS lookup failed (UnknownHostException) on the ERROR. Not sure if it was your intention to log a stack trace on this type of problem.

Again, pretty minor in the whole scheme of things.

2017-06-09 07:32:36.879 [WARN ] [unifi.handler.UniFiControllerHandler] - Error refreshing the UniFi Controller unifi:controller:7036b81d - Could not communicate with the UniFi Controller
2017-06-09 07:32:46.867 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:32:56.869 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:33:06.866 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:33:16.865 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:33:26.864 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:33:36.926 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:33:46.865 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:33:56.866 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:34:06.865 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:34:16.869 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:34:26.862 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:34:36.866 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:34:46.865 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:34:56.869 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:35:06.864 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:35:16.865 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:35:26.866 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:35:36.868 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:35:46.865 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:35:56.861 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:36:06.864 [WARN ] [nding.unifi.internal.UniFiController] - Could not connect to the UniFi Controller
2017-06-09 07:36:31.881 [ERROR] [nding.unifi.internal.UniFiController] - Error trying to authenticate to UniFi Controller
java.net.UnknownHostException: unifi
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)[:1.8.0_131]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)[:1.8.0_131]
at java.net.Socket.connect(Socket.java:589)[:1.8.0_131]
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)[:1.8.0_131]
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)[:1.8.0_131]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)[:1.8.0_131]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)[:1.8.0_131]
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)[:1.8.0_131]
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)[:1.8.0_131]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)[:1.8.0_131]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)[:1.8.0_131]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)[:1.8.0_131]
at org.openhab.binding.unifi.internal.UniFiController.get(UniFiController.java:132)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.internal.UniFiController.get(UniFiController.java:155)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.internal.UniFiController.login(UniFiController.java:192)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.handler.UniFiControllerHandler.refresh(UniFiControllerHandler.java:130)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.handler.UniFiControllerHandler.run(UniFiControllerHandler.java:177)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_131]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_131]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_131]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]
2017-06-09 07:36:31.884 [ERROR] [nding.unifi.internal.UniFiController] - Error trying to authenticate to UniFi Controller
java.net.UnknownHostException: unifi
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)[:1.8.0_131]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)[:1.8.0_131]
at java.net.Socket.connect(Socket.java:589)[:1.8.0_131]
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)[:1.8.0_131]
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)[:1.8.0_131]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)[:1.8.0_131]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)[:1.8.0_131]
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)[:1.8.0_131]
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)[:1.8.0_131]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)[:1.8.0_131]
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)[:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)[:1.8.0_131]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)[:1.8.0_131]
at org.openhab.binding.unifi.internal.UniFiController.get(UniFiController.java:132)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.internal.UniFiController.get(UniFiController.java:155)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.internal.UniFiController.login(UniFiController.java:192)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.handler.UniFiControllerHandler.refresh(UniFiControllerHandler.java:130)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at org.openhab.binding.unifi.handler.UniFiControllerHandler.run(UniFiControllerHandler.java:177)[10:org.openhab.binding.unifi:2.1.0.201705010628]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_131]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_131]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_131]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]

Installation of the JSONPath Transformation binding did not resolve this error for me. However, installing the following jar files from the Maven website in the addons folder did resolve the issue

I think that something else is wrong...

I already have the jackson stuff activated in my OH2 but I also get the same error sometimes (especially during the first startup following an apt-get upgrade...maybe because the tmp and cache folders are being cleaned up and the binding starts too fast before the dependencies become active ?)

It seems to me that the felix installer tries to start the binding too fast (even before the dashboards) and it fails to activate it because the dependencies are not loaded (activated?) yet. This sounds more like a general OH2 issue and not so much a binding issue but I may be wrong.Same story with the Ubiquiti mPower binding by the way.

After the first start following the upgrade... a simple restart puts the system back in normal operations (no errors)

side note (not related to the Unifi binding):If you are running Debian (Jessie) or Ubuntu, do not apt-get upgrade your system today (20/Jun/2017) cause it will break Unifi Controller, Unifi Video NVR and mFi Controller... most possibly the new kernel (3.16.43-2+deb8u1) is the root-cause...

I think you are right about it affecting Debian 8 Jessie as well. I have a machine at work running unifi-video and I did today's update and restarted, sure enough it is no longer working. I am going to cross post this to the unifi-video forums. I...

Just wanted to add another thanks for the work on this binding. Of all the presence detection systems I have tried this was by far the easiest to get going, and so far (I just installed it earlier today) seems to be far more reliable than others also. No battery impact on the phone is just icing on the cake.

My only "complaint" is that it seems to take about 10 minutes for the device to register as offline. This isn't a problem with the binding. I was watching my Unifi controller and that's how long it took for my phone to fall off of the client list.

The folks over at HA seem to have run into the same issue. A proposed solution there is to use the "last_seen" time for each device. I don't know the mechanics of the binding so I don't know if this would be simple to do. Something to consider at any rate.community.home-assistant.io

The Unifi controller shows recently connected devices (with 20 minutes or so) on their client list, but also reports a "last_seen" time for each device. I use this last seen time to filter out the devices who haven't been seen within the...

My only "complaint" is that it seems to take about 10 minutes for the device to register as offline. This isn't a problem with the binding. I was watching my Unifi controller and that's how long it took for my phone to fall off of the client list.

Unfortunately this is how the UniFi controller works On the bright side, there are a handful of interesting time related variables in the controller's JSON API (per-client):

_last_seen_by_uap

_uptime_by_uap

assoc_time

first_seen

last_seen

latest_assoc_time

uptime

Using these, I could add some "enhanced" logic to the binding similar to HA's approach. Something like a client is still considered online iff it was "seen" within the last X minutes. Will have to do some trial and error while debugging the JSON API to see exactly which variables are of interest.

Yeah, that sounds useful to me. I primarily use the unifi binding to add logic to my presence detection so if it was more definitive in when it determines a device has not been seen it would be helpful.