Ubiquiti Unifi Binding Feature Discussion

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.

Thoughts?

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 ?

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).

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?

Matthew

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

1 Like

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.

1 Like

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.

2 Likes

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!
/c

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.

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.

Kurt

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.

org.openhab.binding.unifi-2.3.0-SNAPSHOT.jar

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.

Thoughts?

1 Like

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

1 Like

Same here. Easier than dealing with MAC addresses.

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

1 Like

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…

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:

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:

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.

sure

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

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