-
Notifications
You must be signed in to change notification settings - Fork 3
/
garage_car_presence.yaml
77 lines (69 loc) · 1.42 KB
/
garage_car_presence.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
esphome:
name: garage_car_presence
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_psk
api:
logger:
ota:
binary_sensor:
- platform: status
name: "Garage Presence Sensor Status"
- platform: template
name: "Garage Car Present"
device_class: presence
on_press:
then:
- light.turn_on:
id: status_led
red: 0%
green: 100%
blue: 0%
on_release:
then:
- light.turn_on:
id: status_led
red: 100%
green: 0%
blue: 0%
lambda: >-
if (isnan(id(ultrasonic_garage).value)) {
// NAN means the echo timed out, so return unknown.
return {};
} else if (id(ultrasonic_garage).value < 1) {
// car present
return true;
} else {
// no car
return false;
}
sensor:
- platform: ultrasonic
id: ultrasonic_garage
trigger_pin: D5
echo_pin: D6
name: "Garage Ultrasonic"
filters:
- sliding_window_moving_average:
window_size: 5
send_every: 5
output:
- platform: esp8266_pwm
pin: D2
id: redgpio
- platform: esp8266_pwm
pin: D3
id: greengpio
- platform: esp8266_pwm
pin: D4
id: bluegpio
light:
- platform: rgb
id: status_led
internal: true
name: "Status Light"
red: redgpio
green: greengpio
blue: bluegpio