-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintercom.yaml
110 lines (94 loc) · 2.04 KB
/
intercom.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
esphome:
name: intercom
esp8266:
board: nodemcuv2
# Enable logging
logger:
level: info
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
reboot_timeout: 0s
ota:
password: !secret ota_password
# Wi-Fi Settings
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Optional manual IP
manual_ip:
static_ip: 192.168.50.230
gateway: 192.168.50.1
subnet: 255.255.255.0
captive_portal:
web_server:
port: 80
# Logic
globals:
- id: is_autoopen_enabled
type: bool
restore_value: 'false'
initial_value: 'false'
- id: voltage_threshold
type: float
initial_value: '1.0'
## GPIO pin for pressing relay
output:
- platform: gpio
pin: D1
id: d1
## Button for opening door
button:
- platform: output
name: "Intercom - Open Button"
id: "button_gpio_d1"
output: d1
duration: 1s
switch:
- platform: template
id: autoopen_switch
name: "Intercom - Autoopen Switch"
lambda: |-
if (id(is_autoopen_enabled)) {
return true;
} else {
return false;
}
turn_on_action:
- lambda: id(is_autoopen_enabled) = true;
turn_off_action:
- lambda: id(is_autoopen_enabled) = false;
binary_sensor:
- platform: template
id: ringing_binary_sensor
name: "Intercom - Is Ringing"
device_class: sound
lambda: |-
if (id(gpio_a0).state > id(voltage_threshold)) {
return true;
} else {
return false;
}
sensor:
- platform: adc
id: gpio_a0
pin: A0
internal: true
name: "Intercom - A0 Pin Voltage"
update_interval: '0.5s'
filters:
- multiply: 3.3
on_value:
if:
condition:
- lambda: return id(autoopen_switch).state && id(gpio_a0).state > id(voltage_threshold);
then:
- logger.log: "Autoopen triggered"
- button.press: button_gpio_d1
- platform: uptime
name: Uptime Sensor
filters:
- lambda: return x / 3600.0;
unit_of_measurement: "hours"
accuracy_decimals: 2