Presence at home being reset

Hi, using my Huawei router I know who is at home and I can use this for automation. For example, when someone gets is at the door, it’s from the family and it’s dark, it lightens the entry of the house. Wifi detects the presence and I switch a relay. Fine until now.

But, a couple of minutes or seconds, the status switches from Home to Away:


A couple of minutes later, it switches to Home again and the process repeats. With lights there is no problem because it’s just saying to switch On again. But I also use the same process to start Spotify and, as soon as I stop it, it starts again.

First, any clue of why the status is switching from Home to Away in just a half a minute ? Is this any Android or Router configuration ? Any idea on how to disable this and keep the Home status until i Leave again ?

Thanks for your help

In your automation, you could use the for x minutes command. So unless the devices show away for more than the time you specify it won’t trigger.

And also, you could consider using a template binary sensor. See last example here…

Thanks for the help but probably I did not explain me well. When the router detects my presence, it then switches me to Home. That is correct. But then somehow I get reset to Away even though I do nothing with the phone. Any ideas why ?

Then it comes back to Home re-triggering the process.

Any idea of why something resets me to Away ?

It’s going to happen. Devices and routers will lose connection all the time, hence why I was suggesting you put a time threshold before it triggers to avoid these false triggers. It’s not like you need to trigger your lights to go off when it detects you away immediately. It can wait a few minutes to make sure you’re really away. Coming home of course, you can have it trigger immediately. Just edit your away automations to wait a bit longer before the trigger.

Also, the template binary sensor is a good way to track all 3 devices in your house and only trigger when all 3 are gone. This could also solve your problem since the likelihood of all 3 dropping connection at the same time is low.

Yes, but the problem is when I get home. If I wait for the trigger, them it does not light ON as soon as I enter home and this is the purpose. Easy, I am doing that.

But now I enter home and then I turn Off the light for some reason. The phone goes "Away"for a reason I do not understand and when, after some time changes to “Home”, triggers again because thinks I am back home again.

So I would need a way to, after entering home, it could not retrigger for several hours even when the state changes from Away to Home.

Not sure how you’ve set up your automations, but if you have one automation for “home” mode and a separate one for “away” you can do exactly what I outlined above and it works well. I use it in my config. No delay for coming home, only for triggering away mode.

This is the code:

- action:
  - data:
      entity_id: switch.canal_1
    service: switch.turn_on
  alias: Turns On light when arriving home
  condition: []
  id: '1512750409333'
  - entity_id: device_tracker.mi5miphone
    from: not_home
    platform: state
    to: home

As said, the status of the phone switches from Home to Away (I don’t know why) and, when it get’s back to Home, it triggers again.

I can either understand force the phone to remain Home (I don’t now how because it’s retrieving the status from the router) or I can have a software debouncer that, even if the status changes, it will only re-trigger after, let’s say, a 6 hours Away status.

Can you please share your code. That would certainly help.

Thanks for your continued support and regards.

I’m not at home but quickly, here’s what I’d do:

First make a binary template sensor to get the home/away status. Basically, this determines, is at least one person home? (You’ll need to modify for the actual device tracker names)

  - platform: template
          - device_tracker.alexandra
          - device_tracker.rogerio
          - device_tracker.teresa
        value_template: >-
          {{ is_state('device_tracker.alexandra', 'home')
             or is_state('device_tracker.rogerio', 'home')
             or is_state('device_tracker.teresa', 'home') }}

And add these two automations. Just modify the actions to whatever more you’d like it to do. But when someone comes home, it turns the binary sensor we created above to on and triggers the home automation immediately. When the last device “leaves” or shows “not_home”, it turns the binary sensor to off and triggers the away mode automation. But first before triggering it, it waits another 5 minutes to see if you are really gone. Make sense?

  - alias: 'Home Mode'
    id: '1512750409345'
      - platform: state
        entity_id: binary_sensor.people_home
        to: 'on'
      - service: switch.turn_on
        entity_id: switch.canal_1

  - alias: 'Away Mode'
    id: '1512751429345'
      - platform: state
        entity_id: binary_sensor.people_home
        to: 'off'
          minutes: 5
      - service: switch.turn_off
        entity_id: switch.canal_1
1 Like

If your using iOS Devices, they are know to disconnect WiFi when going to sleep mode.

Follow @Jer78 recommendations and your issue will be solved.

Another thing is to set the lights to turn off X amount of minutes after your device is detected as away.

Try this in your device_tracker config (assuming you are using the Huawei Router tracker):

  - platform: huawei_router
    username: user
    password: pass
    consider_home: 00:05:00  <- This is the important one

using this, you won’t have to modify your automations, but if your devices drop off the wifi network (Which I’m 99.9% sure is what is happening), they will only be considered as “not_home” after 5 minutes of not being seen.
You can find more about it here:

Hi, I had the configuration as you say but I misinterpreted the variable and inserted 15 thinking it was 15 minutes not 15 seconds. After your comment I reread it and discovered my mistake.

Thanks for pointing me to the error.

Yes, I will floow @Jer78 recommendations. Thanks.