/* Unifi Items */
Switch S8_PRES "S8 Presence [MAP(Unifi.map):%s]" <switch> (gUnifi) {channel="unifi:client:Unifi_HomeR:S8:online"}
String S8_AP "S8 AP [%s]" <qualityofservice> (gUnifi) {channel="unifi:client:Unifi_HomeR:S8:ap"}
Number S8_RSSI "S8 RSSI [%s]" <qualityofservice> (gUnifi) {channel="unifi:client:Unifi_HomeR:S8:rssi"}
Number S8_UPTM "S8 Uptime [%d]" <time> (gUnifi) {channel="unifi:client:Unifi_HomeR:S8:uptime"}
String S8_UPTF "S8 Uptime F [%s]" <time> (gUnifi)
DateTime S8_TIME "S8 Last Seen [%1$tH:%1$tM:%1$tS]" <time> (gUnifi) {channel="unifi:client:Unifi_HomeR:S8:lastSeen"}
Unifi.map:
ON=Home
OFF=Away
NULL=Unknown
nice trick to display properly the uptime:
Unifi.rules
rule "Format S8 Uptime Display"
when
Item S8_UPTM changed
then
var int days = ((S8_UPTM.state as DecimalType).intValue / (86400))
var int hours = (((S8_UPTM.state as DecimalType).intValue / 3600) - (24 * days))
var int minutes = (((S8_UPTM.state as DecimalType).intValue / 60) - ((1440 * days) + (60 * hours)))
var int seconds = (((S8_UPTM.state as DecimalType).intValue) - ((86400 * days) + (3600 * hours) + (60 * minutes)))
var String result = ""
if (days > 0) { result = result + days + "d, " }
if (hours > 0) { result = result + hours + "h, " }
if (minutes > 0) { result = result + minutes + "m, " }
if (seconds > 0) { result = result + seconds + "s" }
S8_UPTF.postUpdate(result)
end
then put the formatted item (S8_UPTF) on your sitemap
and of course… the emergency rule when the wife enters the house…
rule "Send Pushover when Wife becomes present @ Home"
when
Item I6_PRES changed from OFF to ON
then
logInfo("Wife_Presence", "Wife entered Home")
sendPushoverMessage(pushoverBuilder("Wife entered Home").withPriority(0))
end
Yeah I have similar to control outside lights since the normal use case is on alarm disarm…of course if one of us is home, then there’s no disarm event to turn on the lights, so unifi is used to figure out someone arrived home, turn on lights.
Giving this a go for presense detection, typically I come home through the back of the house, which means I trigger a few motion sensors to walk in through the back door.
Would this work OK to have Alexa play a welcome message? Is there a way to have the binding check the presense of a mobile phone on a particular Access Point?
rule "Play Welcome Message when Kris enters the House"
when
Item Kris_Mobile changed from OFF to ON
then
if (BackEveMotionAlarm == ON && FibaroEye1Motion == ON) {
logInfo("Mobile Presense", "Kris has entered the Home")
Echo_Living_Room_TTS.sendCommand('Welcome Home Kris')
}
end
Regarding the whole -v2 tag in the URL, @Kai had asked me to switch from Jackson JSON processing to GSON processing as it’s provided by the ESH stack - so I created a new branch as it was some pretty big changes. There was also some poorly written exception handling code that I heavily refactored to clean it up (it took me even a while to figure out what I was originally thinking when I wrote it).
Rest assured, this binding is not dead, I just don’t have any spare time - every waking minute I’m working on the electrical at the house.
I promise, this will get included in the repo and it’s going to get new features as I must implement PoE support to increase my WAF stock
Hi Guys, ive created the switches for my two devices (not online currently) and I see this in the log:
15:56:36.203 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from UNDEF to OFF
15:56:36.223 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from OFF to UNDEF
15:56:36.239 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from UNDEF to OFF
15:56:36.256 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from OFF to UNDEF
15:56:46.279 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from UNDEF to OFF
15:56:46.297 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from OFF to UNDEF
15:56:46.317 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from UNDEF to OFF
15:56:46.333 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from OFF to UNDEF
15:56:46.787 [INFO ] [del.core.internal.ModelRepositoryImpl] - Refreshing model 'unifi.items'
15:56:56.363 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from UNDEF to OFF
15:56:56.383 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from OFF to UNDEF
15:56:56.399 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from UNDEF to OFF
15:56:56.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from OFF to UNDEF
15:57:06.440 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from UNDEF to OFF
15:57:06.458 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from OFF to UNDEF
15:57:06.474 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from UNDEF to OFF
15:57:06.497 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from OFF to UNDEF
15:57:16.518 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from UNDEF to OFF
15:57:16.538 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_Mobile changed from OFF to UNDEF
15:57:16.553 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from UNDEF to OFF
15:57:16.569 [INFO ] [smarthome.event.ItemStateChangedEvent] - Jodie_Mobile changed from OFF to UNDEF
PoE support would be enough for me. I already have a use case for my house: when Mains electrical power is down and I am on UPS, I want to shut down the PoE on some ports (for Cameras and APs) on the Unifi switch.
POE support would be amazing with 1000s of uses and will help save the planet!
How’s about hotspot voucher support - press a button and unifi returns a voucher code for your guest wifi that you can give to guests or display on habpanel / sitemap or email to yourself? Saves printing a load and having to find where you put then
Hotspot voucher systems are network admin’s kryptonite. What would you say about an automatically rotating 8 digit passcode that changed say every 24 hours… but I guess this would mean the controller would have to “re-provision” the APs would which cause network downtime so forget what I said…
Let’s assume we’re using one time voucher codes…
Binding generates a code via the controller and stores it in an item
Binding detects someone has joined the guest network
Binding assumes the previously generated and stored voucher is no longer valid
Repeat
This way you could have the next voucher stored in item and displayed in your preferred UI. Would still need a way to force the binding to generate a new code just in case things get out of sync but I’m just thinking out loud for the moment.
However, keeping in spirit with OH2 and bindings should only act as a bridge, this shouldn’t be implemented within the binding. I think it could still be accomplished using actions + rules if the binding had the appropriate info about the guest network (SSID, # of active clients, etc…).
As soon as I’d pressed the post button your first idea about the rotating code jumped into my mind. If you do have to re-provision the APs then this would be a no go I would say. I think I remember seeing one of Willie Howie’s YouTube videos doing something similar. Also if all existing users got kicked off when the code changed then this would be a bit of a pain, say if you had visitors for a weekend or something.
I guess one time vouchers would be the ultimate goal, maybe even with a mechanism to generate ones of different duration. I’m sure there’s a project in the UniFi forum (I’ll see if I can find it again) where someone has basically done this with a Pi and a receipt type printer, using the API so it should be possible. But, as you say if the binding can do bridging that would make life a lot easier (I hadn’t really realised that this is all bindings are ‘allowed’ to do). I guess all the logic then goes into a rule, which maybe better anyway I guess allowing further customisation.