TL:DR - I’m new and need help applying thresholds to departure and arrival from multiple presence sensors.
I’ll start by saying I’m new to HA and Node-RED. I’ve managed to get my basic automations moved over, but struggling where to even begin when it comes to using Node-RED to apply logic to presence detection. I suppose I could be open to doing this another way, I’m just thinking Node-RED since I’m doing everything else this way.
Having both Smartthings and Hubitat integrated, I’ve gathered multiple ways to detect presence using WiFi and geolocation and want to apply thresholds and logic to make the final determination on present/not present. I’ve searched through this section but haven’t seen anything similar.
Present:
-WiFi changes to present = automatically considered present
-Geolocation - Of the multiple geolocation methods (Life360, Alexa, Owntracks, HA mobile app, HE mobile app, ST mobile app, etc…), I want a threshold 3 or more to change to present to be considered present regardless of WiFi presence.
-Lock code - As a backup to the above, a specified lock code can trigger presence
Not Present:
WiFi - Unlike present, I don’t want a WiFi event to automatically trigger a not present. In case phones die, go to sleep, etc… Instead I would like it to just be considered 1 of the devices along with geolocation that go towards the threshold
Geolocation - Similar to present, I was a threshold of 3 or more to change to not present before I am ultimately considered not present.
Verification - I’d like to wait a defined period of time (probably 1 minute) to confirm the 3 or more devices are still not present and then make the final consideration of not present.
It seems like overkill, but I use presence to lock/unlock as well as arm/disarm so even 99% reliable isn’t quite enough.
Has anybody done anything similar that they could share to give me a jumping off point?
I did look at that but it doesn’t look like it applies a threshold to the geolocation trackers.
If there are trackers of type ‘gps’, then the most recently updated tracker will be used.
If it only uses the most recently updated geolocation tracker, it could still trigger a false present, unlock the doors and disarm the alarm system. That’s why I look for multiple geolocation trackers to show present before it’s actually considered present.
I’ve been using the person integration with my wife and I since not long after its release. I have our Alarm system tied to this, doing just what you are trying to do, but without all the extra logic. I can count on one hand how many times it has had a false present, but since I get alerted immediately via Telegram, I can counteract any false detections.
You can look at composite tracker.
Your other options are to tie all your device trackers for a person to some node red global/context/flow variables and use those. You’re making a lot of work on yourself, when you should probably just test the Person integration first, make some basic flows, and watch the detection.
EDIT:
I also forgot there is the Bayesian sensor you can use.
That bayesian sensor looks like it could do what I need!
I could set the WiFi devices at the required threshold and set the geolocation devices so it would need 2 or 3 to reach the threshold. For the door lock portion I could have the code trigger an automation that would update a virtual device and load that into the bayesian sensor as well.
It looks simple enough to provide logic to determine if presence is true, but does it apply that same logic to determine if it’s false? For example, if I set a threshold of 0.95 and set WiFi devices to 0.95 to meet that threshold, when that WiFi device disconnects will it instantly be false because it’s set at the threshold?