summaryrefslogtreecommitdiffstats
path: root/blueprints
diff options
context:
space:
mode:
Diffstat (limited to 'blueprints')
-rw-r--r--blueprints/automation/motion/motion_switch.yaml16
1 files changed, 14 insertions, 2 deletions
diff --git a/blueprints/automation/motion/motion_switch.yaml b/blueprints/automation/motion/motion_switch.yaml
index 67e62b6..dd4111e 100644
--- a/blueprints/automation/motion/motion_switch.yaml
+++ b/blueprints/automation/motion/motion_switch.yaml
@@ -188,8 +188,9 @@ action:
conditions:
- condition: template
value_template: '{{ test == "sensor" }}'
- - condition: template
- value_template: '{{ (states(illuminance_entity) | float) < lux_threshold }}'
+# This will be checked inside to allow short wait
+# - condition: template
+# value_template: '{{ (states(illuminance_entity) | float) < lux_threshold }}'
- condition: and
conditions:
- condition: template
@@ -224,6 +225,17 @@ action:
seconds: 2
continue_on_timeout: false
+# On motion sensors, illuminance is updated only on motion. We need to give some time to propagate
+ - if:
+ - condition: template
+ value_template: '{{ test == "sensor" }}'
+ - condition: template
+ value_template: '{{ (states(illuminance_entity) | float) >= lux_threshold }}'
+ then:
+ - wait_template: '{{ (states(illuminance_entity) | float) < lux_threshold }}'
+ timeout: '00:00:02' # Timeout after 1 minute
+ continue_on_timeout: false
+
- choose: []
default: !input "on_click"
- service: switch.turn_on