-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMH-Z19B+security
158 lines (136 loc) · 3.46 KB
/
MH-Z19B+security
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
substitutions:
plug_name: esp_name
esphome:
name: ${plug_name}
platform: ESP8266
board: nodemcuv2
wifi:
ssid: имя сети
password: пароль сети
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp esp_name Fallback Hotspot"
password: пароль в режиме точки доступа
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ключ подключения к HA
ota:
password: пароль прошивки по радио
# Мигание светодиодом на борту
# status_led:
# id: light_module_status
# pin:
# number: D4
# inverted: false
uart:
- id: mhz_19
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 9600
binary_sensor:
#Пожарные датчики 2 этажа
- platform: gpio
pin:
number: D1
inverted: true
mode: INPUT_PULLUP
name: "smoke sensor 2 floor"
filters:
- delayed_off: 10000ms
device_class: smoke
#Пожарные датчики 1 этажа
- platform: gpio
pin:
number: D2
mode: INPUT_PULLUP
inverted: true
name: "smoke sensor 1 floor"
filters:
- delayed_off: 10000ms
device_class: smoke
#Пожарные датчики пристройка
- platform: gpio
pin:
number: D5
inverted: true
mode: INPUT_PULLUP
name: "smoke sensor pristroyka"
filters:
- delayed_off: 10000ms
device_class: smoke
#Датчик движения гараж
- platform: gpio
pin:
number: D6
inverted: false
mode: INPUT_PULLUP
name: "Garage sensor"
filters:
- delayed_off: 20000ms
device_class: motion
switch:
# сброс датчиков дыма
- platform: gpio
pin: D3
id: smoke_relay
- platform: template
name: "Smoke Relay"
icon: "mdi:lock-reset"
turn_on_action:
- switch.turn_on: smoke_relay
- delay: 10000ms
- switch.turn_off: smoke_relay
- platform: template
name: "MH-Z19 ABC"
optimistic: true
on_turn_on:
mhz19.abc_enable: my_mhz19
on_turn_off:
mhz19.abc_disable: my_mhz19
# restart esp
- platform: restart
id: restart_controller
name: "ESP Security Restart"
# переключение нагрузки
- platform: gpio
pin:
number: D4
inverted: yes
name: "Power Relay"
sensor:
- platform: uptime
id: device_uptime
# internal: true
- platform: wifi_signal
name: "${plug_name} WiFi"
update_interval: 15s
- platform: mhz19
uart_id: mhz_19
id: my_mhz19
co2:
name: "MH-Z19 CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 60s
automatic_baseline_calibration: false
text_sensor:
- platform: template
name: "${plug_name} uptime"
lambda: |-
uint32_t uptime = (id(device_uptime).state);
int minutes = (uptime % 3600) / 60;
int hours = (uptime % 86400) / 3600;
int days = uptime / 86400;
if (days > 0) {
return { (String(days) + " д." + String(hours) + " ч." + String(minutes) + " мин.").c_str() };
}
if (hours > 0) {
return { (String(hours) + " ч. " + String(minutes) + " мин.").c_str() };
} else {
return { (String(minutes) + " мин.").c_str() };
}
update_interval: 60s
icon: mdi:clock-start