-
Notifications
You must be signed in to change notification settings - Fork 17
/
smartdoorbell.yaml
133 lines (117 loc) · 2.54 KB
/
smartdoorbell.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
esphome:
name: smartdoorbell
platform: ESP8266
board: d1_mini
project:
name: zuidwijk.doorbell
version: "2.0"
dashboard_import:
package_import_url: github://zuidwijk/doorbell/smartdoorbell.yaml
wifi:
# networks: []
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "smartdoorbell"
# ap_timeout: 15s
captive_portal:
# Enable logging
logger:
ota:
improv_serial:
# 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: Doorbell ESPHome Version
- platform: wifi_info
ip_address:
name: Doorbell IP
ssid:
name: Doorbell SSID
bssid:
name: Doorbell BSSID
sensor:
- platform: uptime
name: Doorbell Uptime
- platform: wifi_signal
name: Doorbell 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: "Doorbell Relay"
id: relay
internal: true
icon: mdi:alarm-bell
- platform: restart
name: "Doorbell Restart"
- platform: template
name: Doorbell 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: gpio
pin:
number: D5
mode: INPUT_PULLUP
inverted: true
name: "Doorbell"
filters:
# Small filter, to debounce the button press.
- delayed_on: 25ms
- delayed_off: 25ms
on_press:
# Only turn on the chime when it is active.
then:
if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
on_release:
# On release, turn of the chime.
- switch.turn_off: relay
- platform: status
name: "Status Doorbell"