Instant not_home status?

Is there a way to force devices as not_home instantly? I combined both the Asuswrt and regular bluetooth trackers into groups. But the biggest problem is that if anyone leaves the house, it would take a good 3-5 minutes for the Asus tracker to mark as away, whereas the bluetooth already says Away as soon as we step outside the door.

Is there an automation or anything to force the Asus to mark as away instantly exactly like bluetooth? I tried consider_home, and it didn’t work out too well. As soon as bluetooth marks a device as Away, force the Asus to do the same?

Most people here do this using a Bayesian sensor.

If you search the forums you should be able to find some more help for how to adjust this sensor.

1 Like

there’s no reliable router way really. It ll work. In the end. But never immediately or reliably.

setup life360 and the fine CC by @pnbruckner and all your issues are gone…

1 Like

If bluetooth is working why have you changed?

I second this but I wonder if @Mariusthvdb meant to also link to the excellent Composite Device Tracker Platform (also by @pnbruckner).

I use it with:

  • Life360 (I also currently use Google Maps but am considering turning that off as I don’t think it adds anything except the address but there is a custom component elsewhere for that too - Places)
  • Bluetooth
  • a router based tracker

and have never looked back.

1 Like

why of course!
I have it installed also, and works just as fine. If you don’t have Life360, you can surely mix up all your available components.
Though, tbh, life360 on its own suffices in all cases for me. Why add to the load if 1 service does it all, and reliably at that.

Places had a weird effect on my system, took it out again fttb.

True.
And I might also remove my router based tracker. For some reason I had a blind spot to that one possibly being superfluous! I will keep Bluetooth though as that is guaranteed to be accurate when it reports ‘Home’ irrespective of what anything else says.

of course, after having said that, for the first time ever, my life360 CC fails on me…
all of a sudden I only see home/not_home in the more info window and the device_trackers won’t update.

I know the real Life360 traders are fine, as displayed in the dedicated app, and also on my second system…

what on earth could cause this all of a sudden…
did update yesterday to the latest version but things were fine after that, or so I believed… do we need to set new settings somehow @pnbruckner ? Ill hop over to your thread to keep things tidy.

I still use four trackers (life 360, google maps, apple homekit and my router). I use the composite for zone based automations away from home and for the composite I just use the two GPS based trackers that can track all zones not just home and away. For automatons such as coming home, after months and months of trying multiple approaches I ended up just adding all of them vs groups, Bayesian, composite, etc and have never looked back. It works 100% of the time. My main issue was maybe only 5% of the time, one tracker would bounce home/not home, and this would cause an issue, or for the Bayesian, it might take an extra 30 seconds for the required number of trackers to show as home, etc.

So I have an input_select for (home, away, night), and if any tracker goes to Home or On, I change that to home. As far as away I use the Bayesian sensors.

I have not had an issue in months. It may not be as streamlined as some people may like. But after so many failed attempts at the perfect presence sensor, this has been perfect for me

hearing what you say… but what exactly do you mean by this ‘adding all of them’

how do you do it, and what is your automation ?

Here is are my two automations for home and away. It’s just me and my wife.

##########################################
## Setting House Mode based on Presence ##
##########################################
- alias: Home Mode Leaving
  trigger:
  - platform: state
    entity_id: binary_sensor.people_home
    to: 'off'
    for:
      seconds: 15
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  - condition: state
    entity_id: input_select.house_mode
    state: 'Home'
  action:
  - service: input_select.select_option
    entity_id: input_select.house_mode
    data:
      option: 'Away'
  - service: input_select.select_option
    entity_id: input_select.security_system
    data:
      option: 'Armed (Away)'

- alias: Home Mode Arriving
  trigger:
  - platform: state
    entity_id:
      - input_boolean.paul_present
      - input_boolean.tracy_present
      - input_boolean.guests_present
    to: 'on'
  - platform: state
    entity_id:
      - device_tracker.paul_all
      - device_tracker.pauls_iphone_2
      - device_tracker.tracy_all
      - device_tracker.tracys_iphone_2
      - group.extra_device_trackers
    to: 'home'
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  - condition: state
    entity_id: input_select.house_mode
    state: 'Away'
  action:
  - service: input_select.select_option
    entity_id: input_select.house_mode
    data:
      option: 'Home'
  - service: input_select.select_option
    entity_id: input_select.security_system
    data:
      option: 'Disarmed'
  - service: input_boolean.turn_off
    entity_id: input_boolean.vacation_mode

Here are my two Bayesian sensors for my wife and I. I spent a good amount of time tweaking this to work best for me

 - platform: bayesian
   prior: 0.6
   name: Paul Presence
   probability_threshold: 0.92
#   device_class: presence
   observations:
   - entity_id: 'input_boolean.paul_present'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'on'
   - entity_id: 'device_tracker.pauls_iphone_2'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.pauls_iphone'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.google_maps_118087885302155'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.paul'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'

 - platform: bayesian
   prior: 0.6
   name: Tracy Presence
   probability_threshold: 0.92
#   device_class: presence
   observations:
   - entity_id: 'input_boolean.tracy_present'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'on'
   - entity_id: 'device_tracker.tracys_iphone_2'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.tracys_iphone'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.google_maps_11611223760034'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.tracy'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'

Here is the binary sensor I use to determine if anyone is home. I have a couple groups for frequent visitors like family, and also an input boolean I use when I have guests who dont have a presence sensor at my home

 - platform: template
   sensors:
     people_home:
       friendly_name: People Home
       device_class: presence
       value_template: >
         {{ is_state('group.primary_presence', 'on') or
            is_state('input_boolean.guests_present', 'on') or
            is_state('group.extra_device_trackers', 'home')  }}
       entity_id: group.primary_presence,input_boolean.guests_present,group.extra_device_trackers

and here are my groups

# Only for Primary People (aka Paul and Tracy)
primary_presence:
  name: Primary Presence for Routines
  icon: mdi:account-multiple
  view: no
  entities:
    - binary_sensor.paul_presence
    - binary_sensor.tracy_presence

# Add guests here who are staying over
extra_device_trackers:
  name: Guest Presence Sensors
  icon: mdi:account-multiple
  view: no
  entities:
    - device_tracker.carolsiphone
    - device_tracker.jimsiphone

I might be missing a little bit like the apple homekit, but its most things.

Then I use the away, home for my routines based on arrival and leaving

Edit: I will say this is also what has naturally evolved over a period of nearly a year. I’ve not gone back and tried to streamline this much, but I suspect it could be cleaned up a bit.

2 Likes

My solution to “instant away” or instantly at home is sort of star-wars. I have a wireless LAN controller that sends accounting starts and stops to a radius server when devices come and leave. The radius server sends a webhook to HA when both events happen. I haven’t found another reliable way to do this.

Wow, thanks for all the tips! Coming home is instantaneous, but it’s always leaving that annoys me the most. Might try ptdalen’s solution, but what’s the binary_senor.people and the sensor.ha_runtime?

Also, has anyone tried this. Looks promising, but a little confusing.

Is there also a node-red equivalent or no?

only solution for that might be the Bluetooth way. But if you want instantaneous, you’d have to be very careful for timing issues in the automation, since they tend to trigger constantly, and you need conditions to rule out false alarms.

that is very well possible, I use these to prevent overzealous actions:

condition:
  - condition: template
    value_template: >
      {{ trigger.to_state.state is not none and
         trigger.from_state.state is not none and
         trigger.to_state.state != trigger.from_state.state }}
  - condition: template
    value_template: >
      {% set zones = states.zone | map(attribute='name')|list %}
      {{trigger.to_state.state in ['home','not_home'] or
        trigger.from_state.state in ['home','not_home'] or
        trigger.to_state.state in zones or 
        trigger.from_state.state in zones}}
  - condition: template
    value_template: >
      {{ (now() - trigger.from_state.last_changed | default(0)).total_seconds() > 
                                        states('input_number.presence_timer')|int }}

based on my life360 sensors, my presence detection is perfect. Set to 200 meters to have a nice working distance, I get notifications when arriving home to set the night lights etc perfectly in time, and when my kids have reached the end of the street after leaving home (which takes about 30 seconds…)

good enough for me :wink: And I dont use the Bluetooth trackers, since they really cause stress on the system.

Can you expand on this? In what way do they stress the system?

sensor.ha_runtime is a component for HA. Basically I use this in most my automations so they dont trigger after a restart. So HA has to be up for at least one minute in my automation. I just found this easier for me than having to worry if a sensor might be unknown, on/off after a restart and then trigger something I really did not want triggered. It’s not “necessary” for the automation, just a preference

The binary_senor.people is shown above in my post, but the goal of that is to keep my “goodbye” routines from running when people other than my wife and I (Primary presence’s) are at the house. So I have three possible scenarios (check out the code above), that determine if someone is at the house.

  1. My wife and I (the usual)
  2. Guests present (it’s an input boolean). This is for people that do not have a presence tracker, ie “Guests”
  3. Extra device trackers are for people who visit often but dont live at the house. Parents, kids, etc.

I dont want my "goodbye routine running if my wife and I leave but my parents are at the house.

As far as instant not_home. That can be tricky. If you’re willing to have the occasional “goodbye” routine run while you’re sitting at home watching TV because your phone presence flipped quickly, or you disconnected from wifi because you put your phone airplane mode to fix an issue, etc. you can have instant_away.

My away runs about 2-3 minutes after I leave every time. I have not had a false away in a long time, nor have I had a false “I’m still home”.

Presence has probably been one of the things I’ve tried to refine for years (it was smartthings before HA), and I never had good success until I just accecpted that a single conglomerate of sensors was not going to work 100%(at least not for me)

Another possible option for “instantaneous” not_home, could be either a button, or an alexa/google home routine, that you set up. As you’re walking out the door, say “google/alexa, I’m leaving”, or something like that. Have that routine turn on an input boolean. Have that input boolean trigger an automation with a delay of how ever long you need to get out of the house.

yes, that is the most reliable way of setting your home in away mode :wink:

my homepage has those on a Tile;

48

either manually, and sets all kinds of automations in progress, or , well , automatically, based on device_trackers and other sensors.

I forgot to mention that, mostly because the OP wanted a way to

‘force devices as not_home instantly’,

which this won’t do of course. devices are in whatever state they are, and forcing them into a state they are not is not advisable imho… Only do that in the dev-state to test configuration settings now and then…

1 Like

I have found, as did many other users, that using the device_tracker Bluetooth takes its toll on the system. If you check the time it takes to load at startup you get a basic idea. In my setup, that platform takes over 150 seconds, while when no bluetooth is tracked the platform loads in 12-15 seconds.
After that, it seemed to interfere with my Hue setup a lot. I have 2 systems, a MQTT hub with the mosquitto broker and bluetooth loaded, and my main system, without those. The main system subscribes to topics of the broker on the hub system, and, via mqtt, reads several BT devices states.

All I can say is on the Hub system, my Hue hub and lights go unavailable all the time (while of course they are not, search the forum for this issue, and find plenty) and my main system has a rather solid Hue platform.

1 Like

You know, I missed the comment about forcing things away. Reading it again, it sounds like one big part of this is the time it takes the asus presence to set to away (much longer than bluetooth).
You can change the “consider_home” settting for your router to a much shorter period if you like.

What did not work about the consider_home? So the default for the scan rate looks to be 12 seconds, maybe set the consder home to 15 seconds. I’d think that the longest it would take to mark you away in that scenario would be 26 seconds.