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:
Technique | Why I abandoned it |
---|---|
Bluetooth sniffing | Requires carrying around a BT tag, phones won’t work because they use MAC address randomization which cannot be disabled (last time I looked) |
reelyActive | Uses BT so has the same problem without running an app on the phone, requires multiple sensors (read RPis) |
GPSTracker | Too slow to report, jumps around even when not moving by hundreds of feet, significant drain on phone battery |
Tasker+AutoLocation | Too slow |
Wasp-in-the-Box | Doesn’t work well with multiple “wasps” |
Baysian Net | 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.
- you can configure each Generic MQTT Thing to go online/offline based on messages on a LWT topic and then use Thing Status Reporting [3.2.0;3.4.9] (OH 3) or Thing Status Reporting [4.0.0.0;4.9.9.9] (OH 4) to call a rule to publish an alert when one or more Things go offline.
- 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 [4.0.0.0;4.9.9.9] 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.