-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathesp_floor_1
141 lines (118 loc) · 3.1 KB
/
esp_floor_1
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
substitutions:
plug_name: esp-ep-floor1
esphome:
name: ${plug_name}
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret wifiha
password: !secret passwifi
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp epfloor1 Fallback Hotspot"
password: !secret paswapesp
captive_portal:
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
password: !secret api
ota:
password: !secret api
################################################################
switch:
#restart KWT pzem
- platform: uart
uart_id: pzem004t
name: "PZEM-1 floor1 Reset Energy"
icon: mdi:reload-alert
data: [0x01, 0x42, 0x80, 0x11]
- platform: restart
name: "${plug_name} restart"
# restart esp
- platform: restart
id: restart_controller
name: "esp-ep-floor1 Restart"
##############################################################
# Example configuration entry
uart:
- id: pzem004t
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 9600
##############################################################
binary_sensor:
#Датчик открытия двери щитка
- platform: gpio
pin:
number: D3
inverted: false
mode: INPUT_PULLUP
name: "EP sensor door"
filters:
- delayed_off: 10s
device_class: door
#Датчик движения гараж
- platform: gpio
pin:
number: D5
inverted: false
mode: INPUT_PULLUP
name: "Basement Water Sensor"
filters:
- delayed_off: 5s
device_class: moisture
##############################################################
dallas:
- pin: D1
sensor:
- platform: dallas
address: 0x41011432C255C828
name: "Floor 1 Temperature"
- platform: dht
pin: D2
model: AM2302
temperature:
name: "Basement Temperature"
humidity:
name: "Basement Humidity"
update_interval: 60s
# - platform: pzem004t
- platform: pzemac
current:
name: "PZEM-004T floor1 Current"
voltage:
name: "PZEM-004T floor1 Voltage"
power:
name: "PZEM-004T floor1 Power"
energy:
name: "PZEM-004T floor1 Energy"
frequency:
name: "PZEM-004T floor1 Frequency"
update_interval: 15s
###############################################
- platform: uptime
id: device_uptime
# internal: true
- platform: wifi_signal
name: "${plug_name} WiFi"
update_interval: 15s
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