Skip to content

Commit

Permalink
try fix away mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Oct 13, 2021
1 parent d2f704d commit 3cfcf95
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/away_mode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ script:
example: input_boolean.user_one_home
sequence:
- choose:
# User just got home
- conditions:
- alias: User just got home
conditions:
- condition: template
value_template: >
{{ is_state(person, 'home')
Expand All @@ -27,27 +27,31 @@ script:
data:
entity_id: "{{ input_boolean }}"
default:
# User is not yet/still home
- variables:
- alias: User is not yet/still home. Save current state
variables:
current_state: "{{ states(person) }}"
- service: "{{ mobile_app }}"
data:
message: "request_location_update"
# Wait until the state changes
- wait_for_trigger:
- alias: Wait until the state changes
wait_for_trigger:
- platform: template
value_template: "{{ not is_state(person, current_state) }}"
- platform: state
entity_id: binary_sensor.contact_door
to: "on"
- choose:
- conditions:
- condition: template
- alias: User got home
condition: template
value_template: "{{ is_state(person, 'home') }}"
sequence:
- service: input_boolean.turn_on
data:
entity_id: "{{ input_boolean }}"
- conditions:
- condition: template
# User changed to anything but home. So 'not_home' or a zone name
- alias: User changed to anything but home. So 'not_home' or a zone name
condition: template
value_template: "{{ not is_state(person, 'home') }}"
sequence:
- service: input_boolean.turn_off
Expand Down

0 comments on commit 3cfcf95

Please sign in to comment.