I’ve gone Seaside-described custom code leveraging getLastSeen, but after some trials managed to get built-in functionality working very reliably. Here is my config as a sample:
.things file
Bridge unifi:controller:home "Home UniFi Controller" [ host="192.168.x.y", port=8443, username="xxxxxx", password="yyyyyy", refresh=10 ] {
Thing wirelessClient myPhone "My Cellphone" [ cid="xx:xx:xx:xx:xx:xx", site="home", considerHome=60 ]
}
.items file
Group gPeople_Presence <presence>
Switch Presence_myCellphone "My Cellphone [MAP(unifi.map):%s]" (gPeople_Presence) {channel="unifi:wirelessClient:home:myPhone:online"}
unifi.map file
ON=Home
OFF=Away
Note that the Item has to be a Switch.
I’ve created special read-only user for unifi interface with OH2.