Ubiquiti Unifi Binding Feature Discussion

Tags: #<Tag:0x00007f014c331860> #<Tag:0x00007f014c331518>

(Matthew) #526

After doing some more research and thinking about it more, using hostname identifiers could actually be considered more user friendly. Though IMHO, it should be either the MAC address or the hostname. Allowing the user to enter either / both seems redundant and I’m afraid it will just confuse users.


(Raymond) #527

Unfortunately I am indeed an edge-case… Kids with cheap phones stuck on Android 7. So all the fancy features in 8 or 9 of android are not at my disposal. So I will check out what you did in this release (and I understand you cannot maintain code for edge cases).

Do you mind if I fork this off to make my own adaption of this release as I might need my edge-case add-on ?

(Raymond) #528

To clarify: only after a reboot the device uses a new MAC address. Which indeed is weird… (I’ve been a network engineer for 20+ years already and was baffled when I found out).

(Matthew) #529

To be honest, I think there is a use case for tracking by hostname / alias (as viewed by the controller) as it’s a little more user friendly than MAC addresses.

I was thinking about this on my way to the office today and the binding could easily be adapted to accept either a MAC address or hostname as the unique identifier. However, this means the config parameter shouldn’t be called mac anymore as it would accept both MAC addresses and hostnames as valid inputs.

The other option would be to just simply accept hostnames in the MAC address parameter (as a workaround for these edge-cases) and leave it as an undocumented easter egg.

@martinvw can you chime in on this?


(Martin van Wingerden) #530

I would prefer two different optional parameters with a dedicated meaning.

(Hilbrand Bouwkamp) #531

What @martinvw says. If you later on need one of those values of specific reasons it’s not helpful to have them in one parameter.

(Matthew) #532

I agree with the parameters needing to have a dedicated meaning but both optional?

If they’re both optional, I could set a CONFIGURATION_ERROR status with a detail saying at least one of the mac or hostname parameters needs to be defined.

(Charley) #533

Hi there!
I’m kind of new to Openhab specially compared with you guys!
In the search of better presence detection than the one I’ve got i came across this thread and the Unifi binding. I do got a UAP and a Unifi controller running on a Raspberry but I can’t figure out how this binding is installed, is there any chance anyone can point me in the right direction and maybe give me some hints if necessary?
Thank you!

(Mark) #534

Download the jar file from here, and then put it in your openHAB addons directory.

Then in Paper UI,

Configure Controller Thing

  • click on the little blue + icon,
  • select Unifi Binding, then
  • select Unifi Controller
  • configure the Controller using your specific settings

Configure Client Thing

  • click on the little blue + icon again,

  • select Unifi Binding, then

  • select Unifi Client

  • configure the Client using your specific settings

  • Repeat the Client Thing step for additional clients.

Post back here with any questions.

(Kurt S) #535

Hi Matthew,

very strange: I resaved my items file - Items were refreshed and the errors didn’t re-appear again.
I’ll try to re-produce the error and pull more logs as you suggested.


(Matthew) #536

I added client name support so now you can define the client by the MAC address or the name. The name is as it’s seen by the controller - either the hostname or the alias that you can define via the configuration tab in the clients view of the controller.

Please test it out and let me know if you have any issues.


IMO having two “unique” identifier properties that are optional is redundant and could potentially confuse users. Since we have an edge-case where using the MAC address won’t work, I would prefer to just use the name of the client and make it required and just do away with the MAC address altogether.


(Angelos) #537

I like hostnames, FQDNs and (especially) aliases much better than MACs. I am with you on this one :slight_smile:

(Mark) #538

Same here. Easier than dealing with MAC addresses.

(Charley) #539

Thank you mhilbush! I got it working, really nice binding. Suits my needs perfectly.

(Han) #540

I prefer having both but at least the mac address. When having multiple sites the mac address is always the same and detection always works. When only having hostnames it would mean in my case making sure that all mobile equipment is named exactly the same on 15 sites…

(Angelos) #541

There may be another issue with hostnames: Not all devices register a hostname on the Unifi Controller (I am on 5.6.40)
In this case: Their hostname will display the MAC in the Name field of the Clients table.
You can set an Alias of course to overcome this.

Your 15 site setup is also an edge-case but I understand the pain of setting the same Aliases in all 15 sites :slight_smile:

(Andreas) #542

Thanks for the URL and step-by-step instructions.Works perfectly! And many thanks @mgbowman for a great binding! Keep up the good work :slight_smile:

(Matthew) #543

Can you enable TRACE logging and send me a PM with the JSON output of a client only showing the MAC as the name?

This brings me back to the idea of using names and you can always put in the MAC address as a “catch-all” for these edge cases.

I still think we should only have one unique identifier that’s a required config parameter.

(Angelos) #544


want me to TRACE the one that I am currently running (v10 = org.openhab.binding.unifi) or the latest ? (v14 = Ubiquiti Unifi Binding Feature Discussion)

(Matthew) #545

Either build… I want to see what the controller is spitting out in these cases.