I’m curious as to how people are doing presence detection for devices, and what you do with this information. So, I thought I’d throw it out for discussion.
How do you detect devices?
How do you use the data in openHAB?
What works well and/or could be better?
In addition to detecting humans (by virtue of their devices), I’m interested in hearing what other purposes people have. For example, getting a notification when an important device goes offline.
To get the conversation started, I’ve been using an indirect approach to detect my home/work computers. I have my primary monitor (used for both computers) on an energy-monitoring plug, and trigger rules based on the consumption. This has worked well to turn lights/equipment in my office space on and off, but it’s a very specific use case that doesn’t scale at all.
I recently installed an openWRT access point, and I’m planning to try the wifi-presence package, which publishes connect/disconnect events to MQTT. I like that it doesn’t rely on a response from a device (as is the case with arp/ping using the Network binding), so it should work with anything connected to my WiFi network.
I’m looking forward to hearing other ideas and approaches.
I’ve been through just about everything you can think of for presence detection except for FIND. These days I pretty much only use the Android apps ability to update an Item with the SSID of the network the phone is connected to to drive presence detection and have abandoned everything else (detecting when other services go offline is a different discussion, see below).
Things I’ve tried:
Why I abandoned it
Requires carrying around a BT tag, phones won’t work because they use MAC address randomization which cannot be disabled (last time I looked)
Uses BT so has the same problem without running an app on the phone, requires multiple sensors (read RPis)
Too slow to report, jumps around even when not moving by hundreds of feet, significant drain on phone battery
Doesn’t work well with multiple “wasps”
Complicated and doesn’t work significantly better than simpler aproaches (for me at least, YMMV) (This was presented at the big “Here’s what’s new in OH 3 summit we had on YouTube”, I think it’s on the marketplace now)
I haven’t tried FIND yet (I’ve no idea what number they are up to, FIND2 was the last I looked at it).
Note that I’ve noticed that the Android app can be slow to update recently. If that persists as a problem, I’ll move to using Tasker and the WiFi near profile trigger to update the Item.
In general I use Zabbix for this. It monitors my machines and sends me an email when a computer or VM goes offline or becomes unwell (e.g. SWAP is full, not responding to pings, hard disk full, etc.).
However, there are some devices and computers that are home automation relevant that OH may care about and do something different when it goes offline. For that I’ve a number of approaches, most of which are posted to the marketplace.
I used to use the Network binding to ping the devices and even ping certain ports to see if certain services are online but don’t do that any more. Everything talks MQTT in my home automation now (at least those things on WiFi) so I use the MQTT LWT instead.
link the LWT topic to a Channel and Item and instead of using the rule template use a Switch Item to trigger the rule
But what if a sensor doesn’t fall offline but just stops reporting? In that case:
OH 3: Configure one or more sensor Items for a given device with an appropriate Expire to set the Item to UNDEF when it doesn’t update for too long. Then I use Open Reminder [3.3.0;3.4.9) to call a rule that sets a status Switch Item and sends the alert that it’s stopped reporting.
OH 4: I use Threshold Alert and Open Reminder [22.214.171.124;126.96.36.199) which has the ability to call a script when an Item doesn’t update for too long a time (among other things). Note that this is a rewrite and merging of the Open Door template and Threshold Alert template for OH 3. I’m still working on it but it’s at the beta stage for now.
In both cases above, I have the rules configure to call the script both when the sensor is detected as offline as well as when it comes back online (but only if the offline was previously reported).
One thing the 4.0 rule template could do in this use case is if you want to only turn on lights/equipment if the power use reported by the plug is above a certain amount for a certain amount of time.
I don’t actually have to many automations of that sort in my home automation. For the most part I use them for error reporting. On-the-one-hand I want to know if everything is online and on-the-other I want to report an alert to the users if they try to trigger something and it fails because something is offline (e.g. trigger the garage door opener but the device that processes that command is offline than tell them it’s offline so they don’t keep hitting the button).
I kind of like the WiFi near triggers in Tasker because it can report you are home even before you get fully connected to the network, though that only works if your phone has seamless handoff between cell data and WiFi. If not the command to the Item gets lost.
Holy cow, Rich. You aren’t kidding. I’ve heard you mention this in the past, but that’s quite a list.
That’s an interesting scenario I hadn’t thought of. It reminds me of when people repeatedly push elevator buttons.
I live on the third floor of a condo building, so I’ve thought about doing this to unlock my door as I walk up the stairs. However, I’ve also noticed that an unlock command from the Android app will sometimes get lost during the transition from cell to wifi.