-
Notifications
You must be signed in to change notification settings - Fork 27
/
esp8266-example-advanced.yaml
221 lines (185 loc) · 4.66 KB
/
esp8266-example-advanced.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
esphome:
name: "${lower_devicename}"
platform: ESP8266
board: d1_mini
external_components:
- source: github://KinDR007/VictronSmartShunt-ESPHOME@main
refresh: 0s
substitutions:
lower_devicename: "smartshunt"
devicename: "SmartShunt_500A"
config_version: "v2021.06.02.001"
# wifi_fast_connect: "false"
# wifi_reboot_timeout: 0s
accuracy: "2"
wifi:
ssid: "wi-Fi name"
password: "wifipassword"
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${devicename} Hotspot"
password: "mppt15035"
captive_portal:
logger:
baud_rate: 0
api:
ota:
# web_server:
# port: 80
time:
- platform: homeassistant
uart:
id: uart0
tx_pin: D8
rx_pin: D7
baud_rate: 19200
stop_bits: 1
data_bits: 8
parity: NONE
rx_buffer_size: 256
victron_smart_shunt:
uart_id: uart0
sensor:
- platform: wifi_signal
name: "${devicename} WiFi Signal Sensor"
id: rssi_sensor
update_interval: 15s
- platform: template
name: "Wifi Quality"
unit_of_measurement: "%"
accuracy_decimals: 0
icon: "mdi:wifi"
update_interval: 15s
lambda: |-
int quality;
const int rssi = id(rssi_sensor).state;
if (rssi <= -100) { quality = 0;}
else if (rssi >= -50)
{ quality = 100; }
else
{ quality = 2 * (rssi + 100); }
return quality;
- platform: uptime
name: "${devicename} Uptime"
id: uptime_s
update_interval: 5s
- platform: victron_smart_shunt
battery_voltage:
name: "Battery Voltage"
id: bv
accuracy_decimals: ${accuracy}
battery_current:
name: "Battery Current"
id: bc
accuracy_decimals: ${accuracy}
fw_version:
name: "fw"
id: fw
pid:
name: "pid"
id: pid
instantaneous_power:
name: "instantaneous power"
id: instantaneous_power
accuracy_decimals: ${accuracy}
time_to_go:
name: "time to go"
id: time_to_go
consumed_amp_hours:
name: "consumed amp hours"
id: consumed_amp_hours
unit_of_measurement: Ah
accuracy_decimals: ${accuracy}
min_battery_voltage:
name: "Min battery voltage"
id: min_battery_voltage
accuracy_decimals: ${accuracy}
max_battery_voltage:
name: "Max battery voltage"
id: max_battery_voltage
accuracy_decimals: ${accuracy}
amount_of_charged:
name: "Amount of charged"
id: amount_of_charged
filters:
- multiply: 0.001
unit_of_measurement: kWh
accuracy_decimals: ${accuracy}
bmv_alarm_text:
name: "BMV alarm"
id: bmv_alarm
bmv_text:
name: "bmv - text"
id: bmv_pid
last_full_charge:
name: "Time since last full charge"
id: last_full_charge
deepest_discharge:
name: "Depth of the deepest discharge"
id: deepest_discharge
unit_of_measurement: Ah
accuracy_decimals: ${accuracy}
last_discharge:
name: "Depth of the last discharge"
id: last_discharge
unit_of_measurement: Ah
accuracy_decimals: ${accuracy}
discharged_energy:
name: "Amount of discharged energy"
id: discharged_energy
filters:
- multiply: 0.001
unit_of_measurement: kWh
accuracy_decimals: ${accuracy}
state_of_charge:
id: state_of_charge
name: "SoC"
text_sensor:
- platform: template
name: "Config Version"
icon: mdi:information-outline
lambda: |-
return {"${config_version}"};
- platform: version
name: "Esphome Version"
icon: mdi:information-outline
- platform: wifi_info
ip_address:
name: "${devicename} IP Address"
icon: mdi:ip
ssid:
name: "${devicename} Connected SSID"
icon: mdi:wifi
bssid:
name: "${devicename} Connected BSSID"
mac_address:
name: "${devicename} Mac Wifi Address"
- platform: template
name: "${devicename} Uptime (formatted)"
lambda: |-
uint32_t dur = id(uptime_s).state;
int dys = 0;
int hrs = 0;
int mnts = 0;
if (dur > 86399) {
dys = trunc(dur / 86400);
dur = dur - (dys * 86400);
}
if (dur > 3599) {
hrs = trunc(dur / 3600);
dur = dur - (hrs * 3600);
}
if (dur > 59) {
mnts = trunc(dur / 60);
dur = dur - (mnts * 60);
}
char buffer[17];
sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
return {buffer};
icon: mdi:clock-start
update_interval: 5s
switch:
- platform: restart
icon: mdi:reload-alert
name: "${devicename} Restart"