Add PIR holding

This commit is contained in:
Joshua Boniface 2023-11-22 13:00:59 -05:00
parent 0b211d4855
commit 85c9b6e455

View File

@ -20,6 +20,10 @@
#
###############################################################################
substitutions:
# How long a PIR activation should be held for
pir_holdtime: "10s"
esphome:
name: supersensor
name_add_mac_suffix: true
@ -60,6 +64,15 @@ esp32:
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
script:
- id: pir_handler
then:
- lambda: |-
id(pir_motion).publish_state(true);
- delay: ${pir_holdtime}
- lambda: |-
id(pir_motion).publish_state(false);
# Enable logging only via web
logger:
level: DEBUG
@ -220,12 +233,21 @@ switch:
binary_sensor:
- platform: gpio
name: "PIR GPIO"
id: pir_gpio
pin:
number: GPIO33
mode:
input: true
pulldown: true
internal: false
device_class: motion
on_press:
- script.execute: pir_handler
- platform: template
name: "PIR Motion"
id: pir_motion
device_class: motion
sensor: