forked from zuidwijk/esphome-doorbell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dingdong.yaml
137 lines (123 loc) · 2.71 KB
/
dingdong.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
esphome:
name: dingdong
platform: ESP8266
board: d1_mini
project:
name: zuidwijk.doorbell
version: "2.0"
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "ESPHome DingDong Setup"
# Enable the captive portal for inital WiFi setup
captive_portal:
# Enable logging
logger:
ota:
# Enable Home Assistant API
api:
services:
- service: dingdong
then:
- script.execute: dingdong_script
script:
id: dingdong_script
then:
if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
- delay: 200ms
- switch.turn_off: relay
- delay: 600ms
- switch.turn_on: relay
- delay: 200ms
- switch.turn_off: relay
- delay: 600ms
- switch.turn_on: relay
- delay: 200ms
- switch.turn_off: relay
time:
- platform: homeassistant
id: homeassistant_time
text_sensor:
- platform: version
name: dingdong ESPHome Version
- platform: wifi_info
ip_address:
name: DingDong IP
ssid:
name: DingDong SSID
bssid:
name: DingDong BSSID
sensor:
- platform: uptime
name: DingDong Uptime
- platform: wifi_signal
name: DingDong WiFi Signal
update_interval: 60s
globals:
- id: chime
type: bool
restore_value: true
initial_value: 'true'
switch:
- platform: gpio
pin:
number: D1
inverted: false
name: "DingDong Relay"
id: relay
internal: true
icon: mdi:alarm-bell
- platform: restart
name: "DingDong Restart"
- platform: template
name: DingDong Chime Active
id: chime_active
restore_state: false
turn_on_action:
- globals.set:
id: chime
value: 'true'
turn_off_action:
- globals.set:
id: chime
value: 'false'
lambda: |-
return id(chime);
binary_sensor:
- platform: template
name: Trigger
- platform: gpio
pin:
number: D5
mode: INPUT_PULLUP
inverted: true
name: "DingDong"
filters:
# Small filter, to debounce the button press.
- delayed_on: 25ms
- delayed_off: 3000ms # prevents from re-ringing within 3 seconds
on_press:
then:
if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
- delay: 200ms
- switch.turn_off: relay
- delay: 600ms
- switch.turn_on: relay
- delay: 200ms
- switch.turn_off: relay
- delay: 600ms
- switch.turn_on: relay
- delay: 200ms
- switch.turn_off: relay
- platform: status
name: "Status DingDong"