Reliable Home Presence

I know, this has been discussed multiple time, but I just can’t find anything that seems to be reliable enough with my setup.

The idea is that I want to automate some process (light, heating, eventually some kind of soft alarm) based on me or my wife presence.

My biggest problem is my wife’s iPhone. It is an old iPhone SE (first gen) and it seems to be doing funny things to processes, probably to save its ageing battery. HA app just doesn’t work on that phone, it reports its presence like once a week, and even then. Here is what I am running or tried and the problem I have with all of these.

Wife’s iPhone:
HA app: doesn’t update reliably. The “request_location_update” notification doesn’t work either.
OwnTrack: same problem as the HA app, update once or twice a day only
Life360: works mostly reliably but sometime with quite a delay. Can take up to 30 minutes to mark her as home. Clearly doesn’t work with any kind of alarm system based on presence
Samsung SmartThings mobile presence sensor: same as OwnTrack, work maybe 1 out of 3 times only

My phone (Samsung Note10):
Same as above but all apps works relatively accurately, not much problem there

Tried setting up a bayesian sensor but the result are too unpredictable on my wife’s phone, couldn’t get something reliable. I tried multiple combination or probability, but again, most of my sensor are just too unpredictable to be able to setup some kind of probability based on them.

Changing my wife’s phone would probably be the easiest solution at that point but it doesn’t pass the Wife Acceptance Factor test, she absolutely want to keep that small phone!

So, Life360 seems like the way to go but the 30 minutes delay can be quite annoying. I thought I could workaround that using Room-Assistant as it is really fast in detecting presence. I’ve setup a couple of Pi I had left from a project and I am running them as a cluster to cover the house. Work well so far, but since it is a room detection and I only want a “home” or “not_home” sensor. It is either not_home or in a room, and because of that, I just can’t get it to work correctly in my automation. Unless a create a bunch of automation based on all the different room (other than not_home) possible which would be too complicated.

Anyone had those kind of problem? Or any idea how I could workaround these issues?

What about WIFI and/or Bluetooth presence?

You could use your router to tell who is on the network, or ping to test if certain ip addresses are responding.

Using groups (or adding multiple entities to the person) can help reliability by leveraging multiple sources.

Router is also quite unreliable with the iPhone as it keeps disconnecting to save battery.

Groups doesn’t work well either since most of the app are unreliable and the Room detection doesn’t work with home of not home kind of presence.

I’ve just seen that I can setup a binary sensor based on a template. This might be my solution to convert the room-assistant from a room-detection to a global presence detection and then integrate this with a bayesian sensor.

If you’ve got room level presence, you’ve got all you need for a template binary sensor to indicate home/away. I don’t use room assistant but if you can share the states it generates it’ll be trivial to write something.

If you add in a door sensor on all exit doors, you can easily build some logic so that people are only marked as not_home if they’re away and a door recently opened. That’s part of what I do using monitor (the other Bluetooth tracker, but one that’s purely home/away).

1 Like

For room-assistant I just wanted to quickly chime in that you can also setup a device_tracker entity for it, which is the traditional entity type for home/not_home. It just needs to be setup manually, since Home Assistant does not support auto-discovery for those yet.

You can find some more information on the required config here: https://www.room-assistant.io/integrations/home-assistant.html#device-trackers

2 Likes

It’s not complicated, I also use room assistant and I have an automation that does exactly what you need setting a device tracker to home/not_home, I don’t use the device tracker from room assistant as it was a bit too flaky for me. I can share the automation if you want?

Thanks for the suggestion @Tinkerer, but unfortunately, we also have a dog that likes to go out frequently, so the outside doors are being opened often without us leaving the house.

I believe I found a way to get it to work as I want to. It seems to be working so far (2 days) although we’re not getting out too much right now.

For each person, I create a binary sensor based on a template for the room detection, if the room sensor is at anything else than not_home, it means the device (person) is there.

Each person also have a Life360 device tracker running.

Then, I created a bayesian sensor for each person using both previous value (the binary template sensor and the Life360 tracker). If any one of them is on, I consider that person as being home. When both are off, the person is not there.

@mKeRix I saw that in the doc but I couldn’t get it to work, there must be something missing in my config as the entity doesn’t appear in my HA after adding this to my configuration.yaml file:

device_tracker:
  - platform: mqtt
    devices:
      myphonebt: 'room-assistant/device_tracker/bluetooth-classic-aa-aa-aa-aa-aa-aa-tracker/state'
      wifephonebt: 'room-assistant/device_tracker/bluetooth-classic-aa-aa-aa-aa-aa-aa-tracker/state'
    payload_home: 'true'
    payload_not_home: 'false'
    source_type: bluetooth

If I could get the device_tracker to work, I could get rid of my binary sensor template!

Bluetooth detection (with small BLE beacons like NUT) is very reliable.
However some downsides :

  • you will have to add a BLE beacon to your keychains for instance (NUT Mini are very small and light)
  • you will gave to replace NUT batteries every 4 to 12 months
  • if your house is large, you will probably have to some BLE antenna : for instance RPI 0W are perfect, cheap, reliable, very low consumption, wifi, bluetooth.

But this is way more reliable than wifi/phones/…
I’ve used it for 2 years with my previous Home Automotion. Very reliable.

In my new house, I’ve installed an alarm (Paradox brand) that can send its status to Home Assistant, so I use this alarm status to set my Home Assistant Status : Home, Away, Sleep. :slight_smile:

One other way would be to have cameras at each house entrance and run a program like Deepstack or any other that can identify people. There are very reliable open-source programs nowadays.

1 Like

Hi,

How have you managed Presence detection in Home Assistant?
im running a Pi4 4Gb
Home Assistant 0.117.6, installed from the home assistant image
Randomly they might show as home, I had 1 showing away (it was wrapped in tinfoil)
unwrapped it showed home
wrapped it up showed away and that was the last time it did anything.
All Nut2 tags showing away in Home Assistant but work Perfectly in Domoticz
I even bought the 3 Nut2’s and put them virtually ontop of the Pi

in my configuration.yaml I have the following lines
Any Ideas cheers been on this a week now with different things i picked up off the internet but nothing works as yet

# Bluetooth tracker
device_tracker:
  - platform: bluetooth_le_tracker
    interval_seconds: 20
    track_new_devices: true
    interval_seconds: 12
logger:
  default: info
  logs:
    homeassistant.components.bluetooth_le_tracker: debug

I was able to get semi (I don’t have a Pi in every room) room detection using room-assistant (https://www.room-assistant.io/). I am using this with my phone but I am pretty sure it would also work with a BLE tag.

There is a device tracker that can generate presence level (home or away) that comes with Room-Assistant but I was unable to get it to work. I am probably missing something in my config but couldn’t find it. I managed to get a workaround using a template platform:

  - platform: template
    sensors:
       pfbthome:
          value_template: >-
             {{ states('sensor.pfnote10_room_presence') != 'not_home' }}
  - platform: template
    sensors:
       apbthome:
          value_template: >-
             {{ states('sensor.apiphone_room_presence') != 'not_home' }}

That, coupled with a Life360 device_tracker inside a bayesian binary sensor and it works well so far. I only have 4-5 days of usage though.

For what it’s worth, your device tracker config looks correct to me. Unfortunately I’m not sure why it’s not working for you. If you ever want to debug this I would try to listen to all topics under room-assistant/device_tracker to see what the available data is. You can even do this directly from Home Assistant by going to the MQTT Integration configuration screen and then listening to room-assistant/device_tracker/#.

I saw you already figured something out with the binary template sensor though, which is just as good. :slight_smile:

I used a few over the years with iPhone.

  • ICMP - This is what I used ages ago. It worked but the disconnect time was an issue because the phone would sleep. I don’t recall but I think I had to set the disconnect time to about 10-20 minutes to make it reliable.
  • WAP - This worked very well. Far better than ICMP. Most wifi units have device tracker integrations.
  • iOS App - Works about as well as the WAP integration.

Now I combine the WAP / iOS app and it’s rock solid. For arrival ICMP should work perfect. Leaving is a bit more of a problem with ICMP. I would try the WAP integration and if that doesn’t work by itself combine it with ICMP.

Hi,
Did you get this working? I’m trying at the moment with some Chipolo BLE tags and it doesn’t work very well at all. I think there’s something like randomised MAC in new BLE devices so not really sure that the Pi will ever be able to deal with them if the MAC address is constantly changing.
Matt.