Ubiquiti Unifi binding

Is some one interested. In a specifik binding to ubiquiti unifi. Controller?


I’m using unifi in another location (amazing system btw, my recommendation). No openHAB/home automation there yet but unifi integration would be a strong argument to set up an instance! :wink:

I just bought Ubiquiti, but I fully agree. It seems quite stable. I have “only” a Unifi AP, My router is a EdgeMax and thus not in scope tfor this binding.

I plan to use the binding for the following purpose:

  • Activity detection of clients / Last Seen property (Presence detection)
  • Monitor AP

I am interested in what your use would be

Hmm good question… Most things I can come up with can already be done without access to the controller. Here’s what I can think of:

  • The basic status details (not as interesting to me)
  • A device is currently active
  • Current AP of a device
  • A device switched from one AP to the other (movement and location detection)
  • Statistics: users/ap, last seen, Current overall traffic
  • Events when a new device enters the network

I was wondering what would be the best structure of the binding (bridges, things). My knowledge of Ubiquiti is limitied to 1 week 3 days and 1 hour, but is already impressed.

It seems obvious that the Ubiquiti Controller should be the bridge, The bridge contains of 0 to n Access points (in Ubiquiti terms this is devices?), which maps nice to a thing in openHAB. I guess what you refer to as a device is what ios called a client in Ubiquiti (eg. some external “machine” (mobile phone, PC etc)) ?

The clients would then be things related to the controller (eg. bridge). That approach would support the fact that a client can roam from one device (AP) to another.

I’m also not a binding development expert but yes I’d agree.

  • One Site on one Controller: Bridge
  • Client devices (mobile phone, PC, etc) as Things of specific ThingType “client”
  • AccessPoints: Things of ThingType “uap” or similar
  • USGs: Things of ThingType “usg” or similar
  • Switches: Things of ThingType “usw” or similar
  • … (these can be added over time)
  • Channels for interesting properties of the above Things (e.g. online, last seen, current number of clients, current AP connected to, …)

(uap, usg and usw are the official short names, see here).

You might want to check out http://www.eclipse.org/smarthome/documentation/development/bindings/how-to.html

I have 3 UAPs and run the Unifi Controller on a VM. I came across this python script (which is unmaintained but still works) - https://github.com/calmh/unifi-api. I wrote a little wrapper which polls the Unifi Controller for changes to the AP of a few known MACs (e.g. the phones of me/wife) and publishes the AP to an MQTT topic.

openHAB then simply subscribes to those topics and thus can monitor when our phones around the house. Works very well.

I use icinga2 to monitor the rest of the Unifi ecosystem.


I’m also* using Nagios to monitor my Unifi setup (I’m managing two controllers with 8 sites), it’s great for that!

The script looks interesting indeed but I think what @mr_eskildsen is proposing is a ready to use binding and that’s something I’d very much like :wink: We can’t expect openHAB users to set up custom scripts and mqtt plus dozens lines of logic to see some Unifi statistics in their setup.

That was exactly my idea. I fully agree that scripts is a quick way to get something up and running. I don’t find it very flexible over time, often they run just fine, so I tend to forget all about them until the day where they don’t work any more for some reason that is unclear.

1 Like

Was trying to figure out why we’d want uap access. Unless it could be used for device presence detection. (Coleadve)

Yep - pretty much the only value to openHAB I see is room/zone presence detection. And it is actually quite good at that, I have yet to find anything else that can achieve that level of presence detection. E.g. I have a rule that turns on Radio Sport when I walk into the kitchen if it is a work day and the wife is out :slight_smile: .

I have moved all monitoring to icinga2 now, much better than trying to crobar into openHAB IMHO. But I realise others still use openHAB for that sort of thing.

1 Like

I agreee at least for my own use.Btw I have to look closer into icinga2, looks interesting.

Someone has already made a simple version…

Might want to combine efforts :slight_smile:

Agree with this. In one location I have 4 Unifi APs. In another location I have 4 Unifi APs and a US-24-250W 24-port switch. The Unifi controller is very capable. The up/down alerts it generates are timely, so there’s no real need for an OH2 binding to do monitoring. The Unifi controller, along with Nagios, keeps me well-informed about the status of my network. :slight_smile:

IMO, presence detection would be the real value-add for a binding.

Thanks for the tip.

I just installed the unifi binding mentioned above. Allthough it is a first rudimentary implementation it seems to be heading very much in the direction that will support my needs (presence detection)

Therefore I will join the discussion in the other thread.

My use case to add to the list…

I currently use python scripts to block/unblock devices from the wireless network with scheduling. Makes devices like the iPad/iPod unable to connect to the internet.


Great idea - hadn’t thought of that one. My daughter is only 14 months old, but I can imagine in a few years this sort of thing will be very useful ;).


@gottsman, excellent idea! I’d also see a use for that openHAB action.

Could you please move this message over to the other thread, wherewe continued the discussion from here? Thanks!