From 18a44754ae5c54e1f4be9c208826d2531aee29c2 Mon Sep 17 00:00:00 2001 From: Kevin Eifinger Date: Sat, 15 May 2021 19:23:09 +0200 Subject: [PATCH] value_template for zone condition --- packages/zone.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/zone.yaml b/packages/zone.yaml index 0c46fe8..993bc24 100644 --- a/packages/zone.yaml +++ b/packages/zone.yaml @@ -37,7 +37,8 @@ automation: event: "enter" condition: - alias: "Only if Kevin is not nearby" - condition: "{{ distance('device_tracker.sm_g975f', 'device_tracker.oneplus_a3003') < 1 }}" + condition: template + value_template: "{{ distance('device_tracker.sm_g975f', 'device_tracker.oneplus_a3003') < 1 }}" action: - alias: "Wait until Sina leaves Zone again" wait_for_trigger: @@ -53,10 +54,15 @@ automation: entity_id: sensor.travel_time_home_user_two_here - alias: "Wait 5s" delay: 5 + - variables: + notification_message: > + Sina hat Elmo verlassen. + Sie braucht circa {{ states('sensor.travel_time_home_user_two_here') | int }} + Minuten bis nach Hause. - alias: "Notify Kevin via mobile app" service: notify.mobile_app_sm_g975f data: - message: "Sina hat Elmo verlassen. Sie braucht circa {{ states('sensor.travel_time_home_user_two_here') | int }} Minuten bis nach Hause." + message: "{{ notification_message }}" - alias: "Only when Kevin is home and Alexa Notifications turned on" condition: and conditions: @@ -77,5 +83,4 @@ automation: data: type: announce method: speak - message: "Sina hat Elmo verlassen. Sie braucht circa {{ states('sensor.travel_time_home_user_two_here') | int }} Minuten bis nach Hause." - \ No newline at end of file + message: "{{ notification_message }}"