-
Notifications
You must be signed in to change notification settings - Fork 4
/
esph_bedroom.yaml
57 lines (51 loc) · 1.54 KB
/
esph_bedroom.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
# Bedroom
#
# Provides occupancy of anyone in bed.
#
# https://github.com/jcallaghan/esphome-config/blob/main/.readme/esph_bedroom.md
#
substitutions:
system_name: bedroom
friendly_name: Bedroom
device_description: "Pressure pad sensors placed under mattress to detect occupancy and presence in bed. Readme via https://github.com/jcallaghan/esphome-config/blob/main/.readme/esph_bedroom.md"
packages:
device: !include devices/esp32_pico.yaml
binary_sensor:
# Left pressure pad.
# https://esphome.io/components/binary_sensor/gpio.html
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "ESPH ${friendly_name} Bed Left Occupied"
id: bed_left
device_class: occupancy
# Right pressure pad.
# https://esphome.io/components/binary_sensor/gpio.html
- platform: gpio
pin:
number: GPIO16
mode: INPUT_PULLUP
inverted: True
name: "ESPH ${friendly_name} Bed Right Occupied"
id: bed_right
device_class: occupancy
# Template combining left and right states.
# https://esphome.io/components/binary_sensor/template.html
- platform: template
name: "ESPH ${friendly_name} Bed Occupied"
device_class: occupancy
lambda: |-
if (id(bed_left).state || id(bed_right).state) {
// Bed occupied.
return true;
} else {
// Bed not occupied.
return false;
}
# Debounce state.
# https://esphome.io/components/binary_sensor/index.html#binary-sensor-filters
filters:
- delayed_off: 60s