summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2024-06-13 05:41:46 +0400
committerSuren A. Chilingaryan <csa@suren.me>2024-06-13 05:41:46 +0400
commit6ff83b7acca705bbeca565783eb9c14129118f81 (patch)
treedaeef3b24cd3fcdfea74c86c0a70e62762eba2c2
parentcc45b7a670931c077514ca8f4daeb87d62f659d9 (diff)
downloadhass-6ff83b7acca705bbeca565783eb9c14129118f81.tar.gz
hass-6ff83b7acca705bbeca565783eb9c14129118f81.tar.bz2
hass-6ff83b7acca705bbeca565783eb9c14129118f81.tar.xz
hass-6ff83b7acca705bbeca565783eb9c14129118f81.zip
Allow some delay for Aqara sensors to propogate luminance after motion started (in motion_switch blueprint). Use luminance of presence sensor in kitchen automation
-rw-r--r--automations.yaml4
-rw-r--r--blueprints/automation/motion/motion_switch.yaml16
2 files changed, 16 insertions, 4 deletions
diff --git a/automations.yaml b/automations.yaml
index f661b33..97244a2 100644
--- a/automations.yaml
+++ b/automations.yaml
@@ -992,8 +992,8 @@
- switch.kitchen_ledlights
motion_entity: binary_sensor.motions_kitchen
illumination_test: sensor
- illuminance_entity: sensor.kitchen_motions_illuminance_lux
- lux_threshold: 80
+ illuminance_entity: sensor.kitchen_presence_illuminance_lux
+ lux_threshold: 40
- id: '1673037015865'
alias: 'Motions: Night Light'
description: ''
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