-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbedsensor.yaml
85 lines (76 loc) · 1.98 KB
/
bedsensor.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
esphome:
name: bedsensor
platform: ESP32
board: esp32dev
wifi:
ssid: "#####"
password: "########"
manual_ip:
static_ip: #######
gateway: #######
subnet: ######
captive_portal:
logger:
api:
ota:
web_server:
sensor:
- platform: adc
pin: GPIO34 # Use ADC pin on ESP32
attenuation: 11db
name: "Left Bed Sensor"
id: "Left_bed_sensor"
icon: mdi:bed
update_interval: 0.5s
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 1
- or:
- throttle: 180s
- delta: 0.02
- platform: adc
pin: GPIO35 #Use ADC pin on ESP32
attenuation: 11db
name: "Right Bed Sensor"
id: "Right_bed_sensor"
icon: mdi:bed
update_interval: 0.5s
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 1
- or:
- throttle: 180s
- delta: 0.02
- platform: homeassistant
name: "Left Bed Trigger Level"
id: "Left_bed_trigger_level"
entity_id: input_number.Left_bed_trigger_level
- platform: homeassistant
name: "Right Bed Trigger Level"
id: "Right_bed_trigger_level"
entity_id: input_number.Right_bed_trigger_level
binary_sensor:
- platform: template
name: "Left Bed Occupied"
device_class: occupancy
id: leftoccupancy
# Checks to see if voltage is lower than the trigger level set via input number, if so it sets left bed side to occupied
lambda: |-
if (id(Left_bed_sensor).state < id(Left_bed_trigger_level).state) {
return true;
} else {
return false;
}
- platform: template
name: "Right Bed Occupied"
id: rightoccupancy
# Checks to see if voltage is lower than the trigger level set via input number, if so it sets right bed side to occupied
device_class: occupancy
lambda: |-
if (id(Right_bed_sensor).state < id(Right_bed_trigger_level).state) {
return true;
} else {
return false;
}