From c1f6e7ef5f959bf93c3b7169c1b09981730caf2b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 7 Jun 2021 18:24:16 +0200 Subject: [PATCH] Add referencing sensor entities for before/after in time conditions (#18115) --- source/_docs/scripts/conditions.markdown | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/source/_docs/scripts/conditions.markdown b/source/_docs/scripts/conditions.markdown index f6578d05df3..451e0151166 100644 --- a/source/_docs/scripts/conditions.markdown +++ b/source/_docs/scripts/conditions.markdown @@ -474,15 +474,29 @@ A better weekday condition could be by using the [Workday Binary Sensor](/integr -For the `after` and `before` options a time helper (`input_datetime` entity) can be used instead. +For the `after` and `before` options a time helper (`input_datetime` entity) +or another `sensor` entity containing a timestamp with the "timestamp" device +class, can be used instead. ```yaml condition: - condition: time - after: input_datetime.house_silent_hours_start - before: input_datetime.house_silent_hours_end + - alias: "Example referencing a time helper" + condition: time + after: input_datetime.house_silent_hours_start + before: input_datetime.house_silent_hours_end + + - alias: "Example referencing another sensor" + after: sensor.groceries_delivery_time ``` +
+ +Please note that the time condition only takes the time into account. If +an referenced sensor or helper entity contains a timestamp with a date, the +date part is fully ignored. + +
+ ## Zone condition Zone conditions test if an entity is in a certain zone. For zone automation to work, you need to have set up a device tracker platform that supports reporting GPS coordinates.