Here you go…
Please checkout the updated README
online channel was changed to a
Contact - The normal (state) of the
Contact can be configured on the Thing definition allowing you to change the polarity*.
uptime channel (
Number) - This is the time, in seconds, the wireless client has been connected to the controller. The UniFi Controller UI displays this value in the UPTIME column.
lastSeen channel (
DateTime) - This is the date & time the wireless client was last seen by the controller.
* Since I couldn’t decide what the normal
Contact state should be for absent vs present states, I added a Thing Configuration parameter
contactType so you get to decide
Please update to the latest build org.openhab.binding.unifi-2.2.0-SNAPSHOT.jar and report back if you guys have any issues.
For now, I’m leaving the binding purely stateless. We will just have to live with the delay introduced by the controller when it comes to marking a client as absent. Maybe in the future I will find a simple way to support some kind of binding specific timeout.
Looking forward to feedback.
I can give you one of my use cases that may switch on a lightbulb (no pun intended… ok maybe a little)
I track my wife and I’s iPhones. I have a “It’s Bedtime” scene that is trigged when the living room’s harmony switches off in the evening. All the lights along the path to the bedroom dim up and both of our bedside table lamps turn on.
When both bedside table lamps turn off, this means “we’re in bed” and all the lights in the house turn off.
What does this have to do with presence detection?
My wife travels a lot for work so when she’s not home, her bedside lamp doesn’t come on - I only have to turn mine off. I got annoyed having to roll over every night and turn hers off whenever she was away. Am I lazy? Yes, yes I am!