From 5df5b69aa83361e3f1cc2e7510c626a2f5614aa6 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 16 Feb 2017 10:22:53 +0100 Subject: [PATCH] Add wait_template for 0.39 (#2037) * Update scripts.markdown * Update scripts.markdown --- source/getting-started/scripts.markdown | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/getting-started/scripts.markdown b/source/getting-started/scripts.markdown index 69441a23ab9..513c5e5e266 100644 --- a/source/getting-started/scripts.markdown +++ b/source/getting-started/scripts.markdown @@ -74,6 +74,20 @@ delay: # Valid formats include HH:MM and HH:MM:SS delay: {% raw %}'00:{{ states.input_slider.minute_delay.state | int }}:00'{% endraw %} ``` +### {% linkable_title Wait %} + +Wait until some things are complete. We support at the moment `wait_template` for waiting until a condition is `true`, see also on [Template-Trigger](/getting-started/automation-trigger/#template-trigger). It is possible to set a timeout after that will the script abort his execution. Timeout have same syntax as `delay`. + +```yaml +# wait until media player have stop the playing +wait_template: {% raw %}"{{ states.media_player.floor.states == 'stop' }}"{% endraw %} +``` + +```yaml +# wait until a valve is < 10 or abort after 1 minutes. +wait_template: {% raw %}"{{ states.climate.kitchen.attributes.valve < 10 }}"{% endraw %} +timeout: 00:01:00 +``` ### {% linkable_title Fire an Event %}