Hello there,
so I am trying to make a template sensor telling me the state of a person based on the mobile app and the router device tracking.
So basically there are 3 states: home, away and sleeping. A person is home when the geo position of the mobile app says that is home AND the router device tracking says is home, a person is away if the geo position of the mobile app says that is not_home, a person is sleeping if the geo position of the mobile app says that is home AND the router device tracking says is not_home (mobile phone in aero mode or turned off).
The state itself is working fine, my problem is the state changing.
So from home to sleeping is ok, same as from home to away.
I am facing problems from away to home because the geo position arrives before the router can again track the mobile phone, so I have alway a certain amount of time of SLEEPING between away and home. So now the flow is not AWAY -> HOME but AWAY -> SLEEPING -> HOME
{% elif is_state('device_tracker.mobile_app', 'home')
and is_state('device_tracker.router_scan','not_home')
and not is_state('sensor.person_state','Away') %}
Sleeping
{% else %}
Thanks, I’ll check the link.
Meanwhile with and not is_state('sensor.person_state','Away') you mean I can use the sensor.person_state inside "sensor.person_state ??
No worries I was just asking because I ‘solved’ my issues with my ‘night’ mode by using the automation with Shortcuts in iOS. I think you can do similar things with Tasker on Android.