#What's the ideal setup for managing home/away scenes?
1 messages · Page 1 of 1 (latest)
Scenes?
Create an away scene with the lights that you want and in what states you want them and then call it from your away automation
Avoid using GPT to help you with Home Assistant-related questions. It doesn't know what it is talking about. (Both figuratively and literally.)
Personally, I don't use scenes (although I'm sure they could work just fine), but I just have the automation handle what I want turned on and off.
When leaving, the lights.all_lights group is turned off and tablet screens are turned off. When I arrive home, the tablet screens are turned on, living room and bedroom lights are turned on IF illuminance is below 5, and, most importantly, the Xbox is turned on. (Interior motion detectors already handle other lights, as needed.)
I also have a condition that checks an input_boolean entity that acts as a Guest Mode. Guest Mode has to be off in order for the sequences to fire. (This was a needed feature as there was someone hanging out at my place when I left to go to the store. Per the leaving automation, they were left in the dark for a bit...)
For me, my set-up is easy because if my phone leaves the zone, my place is empty. If you have multiple people in your household, you may have to consider options of when everyone has left the home and when someone returns home. Not difficult to set up, but just something to consider.
What I ended up doing was creating an input_select for home mode with various states (home, away, and also pre-arrival, stay, and extended away) and then I use automations to change home mode and then I have an automation that uses choose to run a different script when the home mode changes depending on what it changed to.
The automations for home and away are basically just when zone.home > 0 or = 0. The scripts turn off lights, turn on alarm, etc. the other modes are more complicated (use proximity, distance, etc).
I have people setup for me, my wife, and “Guest”. For each user i have an input_boolean for if they’re home or not and i have homekit automations that set them to on/off based for my wife and I and a manual switch for guest. I then have an automation that watches these and calls device_tracker.see to create device trackers that the people entities can use. For mine I also just use the HA companion app phone device tracker, but my wife doesn’t use the HA app. Note device_tracker.see trackers don’t persist so you also need an automation to call see on HA start/restart
The scripts control lights, fans, locks, alarms, air conditioning heat pumps, etc etc
To save you some time, this is what I use for the input_boolean to device_tracker ->
alias: Update Device Trackers from Apple Home Input Booleans
description: >
Updates device_tracker presence based on input_booleans exposed to Apple Home
via HomeKit.
triggers:
- entity_id:
- input_boolean.presence_wife_apple_home
- input_boolean.presence_me_apple_home
- input_boolean.presence_guest
trigger: state
conditions:
- condition: template
value_template: "{{ trigger.to_state.state in ['on', 'off'] }}"
actions:
- data:
dev_id: |
{{ trigger.entity_id.split('.')[-1] | replace('presence_', '') }}
location_name: |
{{ 'home' if trigger.to_state.state == 'on' else 'not_home' }}
action: device_tracker.see
mode: queued
max: 10
and
alias: Restore Device Trackers on Startup
description: |
Restores device_tracker states from input_booleans on Home Assistant startup
triggers:
- trigger: homeassistant
event: start
actions:
- delay: 30
- repeat:
for_each:
- input_boolean.presence_wife_apple_home
- input_boolean.presence_me_apple_home
- input_boolean.presence_guest
sequence:
- data:
dev_id: |
{{ repeat.item.split('.')[-1] | replace('presence_', '') }}
location_name: |
{{ 'home' if is_state(repeat.item, 'on') else 'not_home' }}
source_type: router
action: device_tracker.see
mode: single
and then just something simple like this for running scripts when home mode changes:
alias: Home Mode Changed
description: ""
triggers:
- trigger: state
entity_id:
- input_select.home_mode
conditions: []
actions:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: pre-arrival
sequence:
- action: script.home_pre_arrival
metadata: {}
data: {}
- conditions:
- condition: state
entity_id: input_select.home_mode
state: home
sequence:
- action: script.home_home
metadata: {}
data: {}
- conditions:
- condition: state
entity_id: input_select.home_mode
state: stay
sequence: []
- conditions:
- condition: state
entity_id: input_select.home_mode
state: away
sequence:
- action: script.home_set_away
metadata: {}
data: {}
- conditions:
- condition: state
entity_id: input_select.home_mode
state: extended away
sequence:
- action: script.home_set_extended_away
metadata: {}
data: {}
mode: single
home is then just:
alias: Home is Occupied
description: ""
triggers:
- trigger: state
entity_id:
- zone.home
from: "0"
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: home
target:
entity_id: input_select.home_mode
mode: single
and away is:
alias: Home is not Occupied
description: ""
triggers:
- trigger: state
entity_id:
- zone.home
to: "0"
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: away
target:
entity_id: input_select.home_mode
mode: single