Hi! I’ve been looking around but could not find a “simple” solution. My issue would be that it would be useful to have a way to select some automations, switches and lights to run when away.
For example to let HA know I am away and the lights will turn on and off at x time (with a random), switch z will be turned on and off and automation y will run.
Maybe it would be nice to have something like this as a standard in HA?
Have you looked at the “Vacation Lighting” blueprint created by @timgiwo . It may be viewed at Vacation Lighting - Replay History
The “simple” solution is to create an “away” input_boolean and use that in any automation you only want to run when that boolean is turned on (ie when you are away).
you can even automate turning the boolean off and on if you want.
even “simpler” would be to just use the entity that would turn the bollean on and off directly in the automation condition instead of a boolean. That would work best but only if the conditions for “away” are really simple.
otherwise use the boolean method.
There’s the presence simulation integration that repeats the actions of a set of devices going back a configurable number of days.
I’ll check it out this weekend Thanks!
I’m not necessarily trying to steer you away from the “replay history” blueprint. I use a modified version of just the actual automation myself (not the blueprint). it works pretty well.
But it will only work for turning on & off lights and/or switches. So if you want some other functions that won’t do it for you.
Would you have an example so i can work from that? It always helps me to get a better understanding of the input_boolean. Haven’t used it before.
While I don’t have your exact entities this is an example to work from.
first you need to create the boolean. You can create the input_boolean thru yaml or thru the UI (all of the “input_x” entities are generically called “helpers” for some reason).
Here is how to create it in yaml:
input_boolean:
away_mode:
name: Away Mode
then an automation needs to set the state of the boolean (on or off) depending on your needs.
I’ll use the status of a device_tracker and a person entity and make it so that if both are ‘not_home’ then the boolean is ‘on’ (away mode is set):
automation:
- alias: Set Away Mode On
trigger:
- platform: state
entity_id:
- device_tracker.you
- person.someone_else
to: 'not_home'
condition:
- condition: state
entity_id: device_tracker.you
state: 'not_home'
- condition: state
entity_id: person.someone_else
state: 'not_home'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.away_mode
- alias: Set Away Mode Off
trigger:
- platform: state
entity_id:
- device_tracker.you
- person.someone_else
to: 'home'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.away_mode
you could combine the two automations above but I’m using two for clarity and ease of use.
then use that boolean as a trigger or condition in the automations you want to run only if you are away:
- alias: Set Alarm to On
trigger:
- platform: state
entity_id: input_boolean.away_mode
to: 'on'
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.your_alarm_panel
- alias: Set Alarm to On
trigger:
- platform: state
entity_id: binary_sensor.some_motion_sensor
to: 'on'
condition:
- condition: state
entity_id: input_boolean.away_mode
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.panic_siren
Thanks so much! Been a busy weekend but I will fiddle around with this the next few days! Will let you know!