Ubiquiti Unifi Binding Feature Discussion

I tried this manual installation to but no succes!
My devices only updates to “connected” but when disconnected from the WiFi the state don’t change in openhab (worked well on my 2.4 setup).
also tried the OH3.0 snapshot binding but this give me the same result.

any tips to get this working?

OH3.0 binding?? OH is only at 2.5. Where did you find 3.0 ??

here:

https://ci.openhab.org/job/openHAB-Distribution/

I believe the unifi binding is a build of 19 December.

Since the date of the 2.5.0 release version, new builds get the 3.0.0 tag, working towards OH 3.0.0. milestone 1 release… ;o)

Hmm okay :slight_smile:

Also having problems after upgrade to OH 2.5 regarding away detection and Unifi Binding 2.5. Under OH 2.4 presence worked like a charm using Unifi. Now after the upgrade the things I defined are always “ON” and never “OFF” when away. I see a number of these when using the 2.5 binding:

2019-12-30 10:08:03.575 [WARN ] [rnal.handler.UniFiClientThingHandler] - Ignoring unsupported command = OFF for channel = unifi:wirelessClient:MyHome:Iphone:online
2019-12-30 10:39:16.583 [WARN ] [rnal.handler.UniFiClientThingHandler] - Ignoring unsupported command = OFF for channel = unifi:wirelessClient:MyHome:Iphone:online
2019-12-30 10:58:31.834 [WARN ] [rnal.handler.UniFiClientThingHandler] - Ignoring unsupported command = OFF for channel = unifi:wirelessClient:MyHome:Iphone:online
2019-12-30 11:13:24.810 [WARN ] [rnal.handler.UniFiClientThingHandler] - Ignoring unsupported command = OFF for channel = unifi:wirelessClient:MyHome:Iphone:online
2019-12-30 11:35:06.481 [WARN ] [rnal.handler.UniFiClientThingHandler] - Ignoring unsupported command = OFF for channel = unifi:wirelessClient:MyHome:Iphone:online

When installing earlier 2.5 bindings (june-nov) I do not get these messages, but things are still always “ON” ie online.

Installed latest binding of 2.4 and now my presence is working again.

I’m not sure if this is related to your problem but there is a bug (for years now) where wifi devices are not properly logged out of the controller: https://community.ui.com/questions/Wifi-devices-showing-as-LAN/0771fb9f-84f0-4111-a417-3eada0d88c9d

Keep an eye on your controller and check if your Wifi devices appear as LAN devices (as mentioned in the link). If there are still visibable as LAN devices, the binding won’t turnt the items off. This is very frustrating.

Christian,

its not. It used to work under OH 2.4 but after the upgrade presence detection stopped working.

regards

Han

Same here, installed the 2.4 binding and it is working again.

Same here, only working with 2.4 binding…

Happy New Year!

Hey guys, sorry for my absence. I had a super busy holiday season with my family and after surviving that, I just had to take a ski vacation :slight_smile: I’m finally back home! I have to put some effort into setting up my dev environment as I got a new laptop for Christmas - yay!

With all the recent changes to the tree, I have some work todo to get everything up to date with the current status of master. Once everything’s all sync’d up, I will begin working on new features that have been requested (and fixing any bugs you guys have uncovered).

I will report back in the coming days!

Matthew

4 Likes

Welcome back Matt. I guess the ski vacation didn´t result in any broken bones then, (or at least arm and hands) :smiley:

Since today I am able to switch on and off POE ports using the “EXEC” binding. Allthough I now am happy with the fact I can switch off stuff when leaving home or switch on stuff when I arrive home, I am not very fond of the steps I had to take. So dear @mgbowman, if it is possible to integrate POE in the binding I would be the first one to test :joy:

Hey Han!

I just took the time last night to get my local OH server updated to 2.5.1-2 (testing/main) and next is to get my dev environment up and running (going to start fresh here considering the repo / namespace changes).

I took this opportunity of starting with a fresh OS to sort / organise my data (something I’ve been needing to do) and I’m almost done. Unfortunately my free time is rather limited as I’ve got some major IRL work projects because it’s the beginning of the year :frowning:

Things will settle down over the next week or so and I’ll have more time to hack away at home!

I promise promise promise I will start development again very very very soon!

Matthew

1 Like

For everybody who wants to have some detail:

things file:

// "%2$s" will be replace by the input channel command, this makes it possible to use one command line with different arguments.
// e.g: "ls" as <YOUR COMMAND> and "-a" or "-l" as additional argument set to the input channel in the rule.
Thing exec:command:poe_actions [ command="/openhab/conf/scripts/poe.sh %2$s", interval=0, autorun=false ]

item file:

//POE Stuff
// state of the execution, is running or finished
Switch poe_actions_Run {channel="exec:command:poe_actions:run", autoupdate="false"}
// Arguments to be placed for '%2$s' in command line
String poe_actions_Args {channel="exec:command:poe_actions:input"}
// Output of command line execution 
String poe_actions_Out {channel="exec:command:poe_actions:output"}	

rule file (presence is arranged through the Unifi binding):

rule "Presence changing"
when 
    Item Presence changed
then { 
    logInfo("Rule presence 03", "Presence just changed!")   
    switch (Presence.state) {
		case ON : { 
			logInfo("Rule presence 03", "Presence just became ON!")
    		poe_actions_Args.sendCommand("192.168.1.15 5 auto")                     // Switch ON telephone 
            poe_actions_Run.sendCommand(ON)
                 }
		case OFF : { 
			logInfo("Rule presence 03", "Presence just became OFF!")
    		poe_actions_Args.sendCommand("192.168.1.15 5 shutdown")                 // Switch OFF telephone
            poe_actions_Run.sendCommand(ON)
           
	    }   
    }  
}     
end             

script file:

#!/bin/bash

NODE=$1                         # IP address
INTERFACE=$2                    # Port number
MODE=$3                         # auto / shutdown

sshpass -p PASSWORD ssh -oStrictHostKeyChecking=no USER@$NODE '(echo "enable" ; echo "configure" ; echo "interface 0/'$INTERFACE'" ; echo "poe opmode '$MODE'" ; echo "exit" ; echo "exit" ; echo "exit") | telnet localhost 23 ; exit;'

quit a bit of hacking :slightly_smiling_face:, make sure the script file is executable, SSHPAS is installed, the EXEC binding is installed and that the openhab user is allowed to run the file. I btw use a Docker OH2.5 image

Back with an update,

My dev env has been restored and I have merged all my local work and sorted my github config considering the changes in “master”. I’m finally back in business :slight_smile:

The latest build includes all my local (unpublished) improvements / features that had been (partially?) implemented and still in need of testing :see_no_evil:

Please see the latest README for more

Currently I’m using this with 2.5.1 and the latest UniFi Controller on a CKG2+

Please update to the latest build and report back if you have any issues.

Cheers,
Matthew


Build #111: org.openhab.binding.unifi-2.5.2-SNAPSHOT.jar - 2.5.2.202001271706


How I update using the cli

// get the unifi bundle id (first column)
openhab> bundle:list | grep -i unifi
282 │ Active │  80 │ 2.5.1                   │ openHAB Add-ons :: Bundles :: UniFi Binding

// refresh (-r) bundle 282 (unifi) after updating using [url] - copy from above
openhab> bundle:update -r 282 [url]

// check the new version was installed
openhab> bundle:list | grep -i unifi
282 │ Active │  80 │ 2.5.2.202001271706      │ openHAB Add-ons :: Bundles :: UniFi Binding
3 Likes

I installed the latest build and it works well so far.
A problem I have since a while is that iPhone XS (on IOS 13.3) is disconnecting often. It seems to go into sleep mode and disconnects from wifi.
Another iPhone 8 (on IOS 13.3) is working like a charm.
Anyone with the same behavior?

1 Like

You don’t by chance have “Low Power Mode” enabled when this happens?

AFAIK, iOS will disconnect / disassociate the wireless antenna while in LPM which will make the phone appear as offline in the UniFi controller.

Thanks for your fast response! No low power mode enabled. iPhone is loosing/disconnect from wireless multiple times per day.

Do the disconnects happen for an extended period of time?

I’m assuming you haven’t changed considerHome and it’s using the default of 180secs / 3mins.

If your phone is disconnecting for more than 3 minutes, it sounds like more of a local Wi-Fi issue and not the binding :thinking:

Matthew