From e8bbeec8f12317d7a6b6b3f80a59f96c94191f58 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Tue, 4 Feb 2020 21:50:51 +0100 Subject: [PATCH] Review after zone changes --- automation/away_mode.yaml | 22 +++++++++------------- automation/guard_mode.yaml | 32 ++++++++++---------------------- automation/speech.yaml | 10 ++-------- script/speech_engine.yaml | 2 +- 4 files changed, 22 insertions(+), 44 deletions(-) diff --git a/automation/away_mode.yaml b/automation/away_mode.yaml index 07e8cc5f..17411068 100644 --- a/automation/away_mode.yaml +++ b/automation/away_mode.yaml @@ -6,9 +6,9 @@ initial_state: 'on' trigger: - platform: state - entity_id: input_boolean.home_mode_away - to: 'on' + - platform: state + entity_id: input_boolean.home_mode_away + to: 'on' action: - service: script.notify_voice @@ -23,9 +23,9 @@ initial_state: 'on' trigger: - platform: state - entity_id: input_boolean.home_mode_away - to: 'off' + - platform: state + entity_id: input_boolean.home_mode_away + to: 'off' action: - service: script.notify_voice @@ -40,13 +40,9 @@ initial_state: 'on' trigger: - - platform: zone - entity_id: - - device_tracker.google_maps_115265981849847357125 - - device_tracker.google_maps_103158638433668748797 - # - device_tracker.google_maps_113099283296073047871 - zone: zone.casa - event: enter + - platform: state + entity_id: group.residents + to: 'home' - platform: template value_template: "{{ states('sensor.time_date') == (state_attr('input_datetime.away_mode_end', 'timestamp') | int | timestamp_custom('%H:%M, %Y-%m-%d', true)) }}" diff --git a/automation/guard_mode.yaml b/automation/guard_mode.yaml index c2a6f2ea..f046938f 100644 --- a/automation/guard_mode.yaml +++ b/automation/guard_mode.yaml @@ -6,20 +6,16 @@ initial_state: 'on' trigger: - - platform: zone - entity_id: - - device_tracker.google_maps_115265981849847357125 - - device_tracker.google_maps_103158638433668748797 - zone: zone.casa - event: leave + - platform: state + entity_id: group.residents + from: 'home' - platform: homeassistant event: start condition: condition: template value_template: >- - {{ (not is_state('device_tracker.google_maps_115265981849847357125', state_attr('zone.casa', 'friendly_name'))) and - (not is_state('device_tracker.google_maps_103158638433668748797', state_attr('zone.casa', 'friendly_name'))) }} + {{ not is_state('group.residents', 'home') }} action: - service: input_boolean.turn_on @@ -34,24 +30,16 @@ initial_state: 'on' trigger: - - platform: zone - entity_id: - - device_tracker.google_maps_115265981849847357125 - - device_tracker.google_maps_103158638433668748797 - zone: zone.casa - event: enter + - platform: state + entity_id: group.residents + to: 'home' - platform: homeassistant event: start condition: - condition: or - conditions: - - condition: zone - entity_id: device_tracker.google_maps_115265981849847357125 - zone: zone.casa - - condition: zone - entity_id: device_tracker.google_maps_103158638433668748797 - zone: zone.casa + condition: template + value_template: >- + {{ is_state('group.residents', 'home') }} action: - service: input_boolean.turn_off diff --git a/automation/speech.yaml b/automation/speech.yaml index 0f68c6ee..1c46fe37 100644 --- a/automation/speech.yaml +++ b/automation/speech.yaml @@ -14,7 +14,7 @@ - device_tracker.google_maps_115265981849847357125 - device_tracker.google_maps_103158638433668748797 # - device_tracker.google_maps_113099283296073047871 - zone: zone.casa + zone: zone.home event: enter # - platform: state # entity_id: @@ -59,13 +59,7 @@ # timeout: '00:30:00' # continue_on_timeout: 'false' - - wait_template: >- - {% if is_state('binary_sensor.porta_casa_stato', 'on') %} - true - {% else %} - false - {% endif %} - + - wait_template: "{{ is_state('binary_sensor.porta_casa_stato', 'on') }}" timeout: '00:30:00' continue_on_timeout: 'false' diff --git a/script/speech_engine.yaml b/script/speech_engine.yaml index bd9ed063..8a53f963 100644 --- a/script/speech_engine.yaml +++ b/script/speech_engine.yaml @@ -106,7 +106,7 @@ speech_engine: {# Car Status #} {%- macro status_car() -%} - {% if is_state('device_tracker.wdd1760081v167576', state_attr('zone.casa', 'friendly_name')) %} + {% if is_state('device_tracker.wdd1760081v167576', state_attr('zone.home', 'friendly_name')) %} {% set car_position = "in garage" %} {% else %} {% set car_position = "fuori" %} -- 2.47.3