Star Trek Presence Detection: openHAB, UniFi & the At Home Card

Hey everyone,

“All hands on deck, Scotty?” :vulcan_salute::satellite_antenna:

I wanted to share my latest project: mapping my family of five to the classic Star Trek TOS crew for smart home presence detection.

To make it bulletproof, I combined the Network (Ping) Binding with UniFi Client Tracking to counter smartphone deep-sleep dropouts. I also ran into a tricky MainUI limitation: the visual editor doesn’t let you add an OR aggregation function to a group tagged as Equipment. At lest I didn’t got it to do so :wink:

I wrote a quick guide on how I bypassed this via the YAML Code Tab, kept the logic clean from format conflicts (like AP string channels), and tied it all together into the At Home Card widget.

Here’s how the result looks like:

If you are tweaking your Wi-Fi presence or fighting with semantic group aggregation, check out the full write-up with all YAML and DSL blocks on my blog:

Let me know what you think!

Sebastian

Typically the types of Items in an Equipment Group are not the same so aggregation isn’t expected. Typically such functional Groups are expected to be created outside the semantic model.

Also, MainUI won’t show the states of Equipment in the Overview tabs. And that’s pretty much the primary purpose of Equipment Groups (though the new AI stuff coming in 5.2 also heavily relies on the Semantic model).

So not being able to add an aggregation function to an Equipment is a deliberate design decision, not an oversight.

A more standard approach here would be too to create an aggregation Group as a Point. You can put this under the presence Equipment Group or leave it as a “floating Point” without an Equipment.

If you want to see the individual Items in the Overview tabs as well as the aggregation, you can put the all in the Equipment.

For example, you would have a Kirk Equipment. You would additionally have a KirkAggregation Group which is a Switch:OR(ON,OFF) with a Point/Property tag and make it a member of Kirk. Finally you would have your N individual Point Items each representing your individual presence sensors and they will be members of both Kirk and KirkAggregation.

With this approach, the aggregation will be displayed in the Overview tabs and you don’t need to do any messing with the code tab to make it work. And the AI will be able to see the aggregation value as well (I don’t know what it will do with an Equipment with a state).

One other thing you might consider as an additional feature is using a “denounce” to smooth out the transitions. For example, my phone disconnects when I go to the mailbox but I don’t want my home to go into away mode in that case. So I set a couple minutes buffer before I’m marked as away. However I want to be marked home immediately upon my phone being sensed so a simple timeout or expire isn’t sufficient. See Generic Presence Detection for details.

Hi,

thanks a lot for your comment, and suggestions. Obviously a topic I’m not done with and have to study more.

Sebastian