Add PIR holding
This commit is contained in:
parent
0b211d4855
commit
85c9b6e455
@ -20,6 +20,10 @@
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
substitutions:
|
||||||
|
# How long a PIR activation should be held for
|
||||||
|
pir_holdtime: "10s"
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: supersensor
|
name: supersensor
|
||||||
name_add_mac_suffix: true
|
name_add_mac_suffix: true
|
||||||
@ -60,6 +64,15 @@ esp32:
|
|||||||
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
|
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
|
||||||
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "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
|
# Enable logging only via web
|
||||||
logger:
|
logger:
|
||||||
level: DEBUG
|
level: DEBUG
|
||||||
@ -220,12 +233,21 @@ switch:
|
|||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
|
name: "PIR GPIO"
|
||||||
|
id: pir_gpio
|
||||||
pin:
|
pin:
|
||||||
number: GPIO33
|
number: GPIO33
|
||||||
mode:
|
mode:
|
||||||
input: true
|
input: true
|
||||||
pulldown: true
|
pulldown: true
|
||||||
|
internal: false
|
||||||
|
device_class: motion
|
||||||
|
on_press:
|
||||||
|
- script.execute: pir_handler
|
||||||
|
|
||||||
|
- platform: template
|
||||||
name: "PIR Motion"
|
name: "PIR Motion"
|
||||||
|
id: pir_motion
|
||||||
device_class: motion
|
device_class: motion
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user