-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoorbell.yaml
96 lines (87 loc) · 2.13 KB
/
doorbell.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
85
86
87
88
89
90
91
92
93
94
95
96
substitutions:
device_name: "Doorbell"
espname: "doorbell"
esphome:
name: '${espname}'
comment: 'ESP32S2'
platformio_options:
board_build.f_flash: 40000000L
board_build.flash_mode: dio
board_build.flash_size: 4MB
board_build.extra_flags:
- "-DARDUINO_USB_CDC_ON_BOOT=0" # Override, defaults to '-DARDUINO_USB_CDC_ON_BOOT=1'
esp32:
board: lolin_s2_mini
variant: ESP32S2
framework:
type: arduino
packages:
wifi: !include common/wifi.yaml
network_diagnostics: !include common/network_diagnostics.yaml
base_config: !include common/base_config.yaml
status_led:
pin: GPIO15
logger:
level: DEBUG
wifi:
power_save_mode: none
switch:
- platform: gpio
pin: GPIO18
name: "${device_name} Ringer"
id: relay
restore_mode: ALWAYS_OFF
on_turn_on:
then:
- delay: 2s
- switch.turn_off: relay
- platform: template
name: "${device_name} Do Not Disturb Mode"
id: dnd_mode
restore_mode: RESTORE_DEFAULT_OFF
optimistic: true
on_turn_off:
then:
- if:
condition:
for:
time: 5s
condition:
api.connected:
then:
- switch.turn_on: relay
- delay: 0.1s
- switch.turn_off: relay
- delay: 0.2s
- switch.turn_on: relay
- delay: 0.1s
- switch.turn_off: relay
binary_sensor:
- platform: gpio
name: "${device_name} Button"
id: gpio_button
pin:
number: GPIO16
mode: INPUT_PULLUP
inverted: True
filters:
- delayed_off: 50ms
on_press:
then:
- homeassistant.event:
event: esphome.doorbell_pressed
data:
title: ${device_name} pressed
device_name: ${device_name}
click_type: single
click_count: "1"
- if:
condition:
switch.is_off: dnd_mode
then:
- switch.turn_on: relay
- delay: 1.5s
- switch.turn_off: relay
on_release:
then:
- switch.turn_off: relay