I am trying to wrap my head around this and I am stuck
What I want to achieve:
When nobody is home for 10 mins several actions should fire. I know how to to that for individuals but I don’t know how to program a smart trigger that only fires when all members of the family have left home.
The logic I have in mind is this:
If all members of group “Family” have left the house for 10 minutes and have left the “nearby zone” then:
Depending on what you consider nearby this could mean the alarm does not go on when you leave.
If nearby zone could be a stop at the local store then you could be nearby and thus the alarm does not activate as you leave.
I understand that you don’t want the alarm to turn on when it’s unnecessary but these conditions you add here could mean the alarm does not turn on at all when it should.
yes, that is my situation here (shop nearby), however I wanted to prevent the alarm to go on/off to often since its battery driven.
Do you have any other suggestion to narrow the risk (like you also described it well) down?
You need to think about this if this fits your setup.
I assumed your home zone is inside the nearby zone and when you leave nearby zone going home you enter home zone without coming to an area not defined in home or nearby zone.
This will look at the for just as finity suggested in the first place and then if you are in nearby zone wait up to 20 minutes to see if you leave nearby zone (this could be increased if you need).
If you leave nearby zone it makes sure you did not go back home.
If you left home zone and nearby zone in less than 10 minutes you get to the else part, that is activate alarm.
alias: Camera - activate when nobody is home
description: Arm the camera
trigger:
- platform: state
entity_id: zone.home
to: "0"
for:
minutes: 10
condition: []
action:
- if:
- condition: numeric_state
entity_id: zone.in_der_nahe
above: 0
then:
- wait_for_trigger:
- platform: state
entity_id:
- zone.in_der_nahe
to: "0"
continue_on_timeout: false
timeout:
minutes: 20
- condition: state
entity_id: zone.home
state: "0"
- service: alarm_control_panel.alarm_arm_away
data: {}
target:
entity_id: alarm_control_panel.blink_home
- service: notify.mobile_app_iphone
data:
message: Main entrance camera active since nobody is at home
title: Camera active
else:
- service: alarm_control_panel.alarm_arm_away
data: {}
target:
entity_id: alarm_control_panel.blink_home
- service: notify.mobile_app_iphone
data:
message: Main entrance camera active since nobody is at home
title: Camera active
mode: single
I don’t have a nearby zone. But one thing I didn’t think about, when you are home, are you also nearby?
What does the nearby also 1 since you are within it or are you only considered home?
When I am home I am inside the nearby zone (physically). However, if I check the state in HA, then I am only home (state = 1), but not nearby (state = 0). Does this require any code/logic change?