forked from syssi/esphome-jk-bms
-
Notifications
You must be signed in to change notification settings - Fork 8
/
esp32-ble-battery_number_001.yaml
422 lines (401 loc) · 13.2 KB
/
esp32-ble-battery_number_001.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
substitutions:
esp_name: jk-bms
bms_name: ble-bms0
device_description: "Monitor and control a JK-BMS via bluetooth"
external_components_source: github://txubelaxu/esphome-jk-bms@main
mac_address: !secret mac_ble_battery_number_001
# Defaults to "JK02" (hardware version >= 6.0 and < 11.0)
# Please use "JK02_32S" if you own a new JK-BMS >= hardware version 11.0 (f.e. JK-B2A8S20P hw 11.XW, sw 11.26)
# Please use "JK04" if you have some old JK-BMS <= hardware version 3.0 (f.e. JK-B2A16S hw 3.0, sw. 3.3.0)
protocol_version: JK02_32S
esphome:
name: ${esp_name}
comment: ${device_description}
project:
name: "txubelaxu.esphome-jk-bms"
version: 1.0.0
esp32:
board: esp32dev #nodemcu-32s #wemos_d1_mini32
framework:
type: esp-idf
external_components:
- source: ${external_components_source}
refresh: 0s
# - source: ./components
# refresh: 0s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ota:
on_begin:
then:
- switch.turn_off: ble_client_switch0
- logger.log: "BLE connection suspended for OTA update"
web_server:
local: true
port: 80
auth:
username: !secret web_server_user
password: !secret web_server_password
logger:
level: INFO #VERY_VERBOSE #VERBOSE #DEBUG #INFO #DEBUG
# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
api:
#mqtt:
# broker: !secret mqtt_host
# username: !secret mqtt_username
# password: !secret mqtt_password
# id: mqtt_client
time:
- platform: sntp
id: sntp_time
timezone: Europe/Berlin
servers:
"0.europe.pool.ntp.org"
esp32_ble_tracker:
on_ble_advertise:
then:
- lambda: |-
if (x.get_name().rfind("JK-", 0) == 0) {
ESP_LOGI("ble_adv", "New JK-BMS found");
ESP_LOGI("ble_adv", " Name: %s", x.get_name().c_str());
ESP_LOGI("ble_adv", " MAC address: %s", x.address_str().c_str());
ESP_LOGD("ble_adv", " Advertised service UUIDs:");
for (auto uuid : x.get_service_uuids()) {
ESP_LOGD("ble_adv", " - %s", uuid.to_string().c_str());
}
}
ble_client:
- mac_address: ${mac_address}
id: ble_client0
jk_bms_ble:
- ble_client_id: ble_client0
protocol_version: ${protocol_version}
throttle: 5s
id: bms0
binary_sensor:
- platform: jk_bms_ble
status_balancing:
name: "${bms_name} status balancing"
status_precharging:
name: "${bms_name} status precharging"
status_charging:
name: "${bms_name} status charging"
status_discharging:
name: "${bms_name} status discharging"
online_status:
name: "${bms_name} online status"
status_heating:
name: "${bms_name} status heating"
alarm_wireres:
name: "${bms_name} alarm WireRes"
alarm_mosotp:
name: "${bms_name} alarm MosOTP"
alarm_cellquantity:
name: "${bms_name} alarm CellQuantity"
alarm_cursensorerr:
name: "${bms_name} alarm CurSensorErr"
alarm_cellovp:
name: "${bms_name} alarm CellOVP"
alarm_batovp:
name: "${bms_name} alarm BatOVP"
alarm_chocp:
name: "${bms_name} alarm ChOCP"
alarm_chscp:
name: "${bms_name} alarm ChSCP"
alarm_chotp:
name: "${bms_name} alarm ChOTP"
alarm_chutp:
name: "${bms_name} alarm ChUTP"
alarm_cpuauxcommuerr:
name: "${bms_name} alarm CPUAuxCommuErr"
alarm_celluvp:
name: "${bms_name} alarm CellUVP"
alarm_batuvp:
name: "${bms_name} alarm BatUVP"
alarm_dchocp:
name: "${bms_name} alarm DchOCP"
alarm_dchscp:
name: "${bms_name} alarm DchSCP"
alarm_dchotp:
name: "${bms_name} alarm DchOTP"
alarm_chargemos:
name: "${bms_name} alarm ChargeMOS"
alarm_dischargemos:
name: "${bms_name} alarm DischargeMOS"
alarm_gpsdisconneted:
name: "${bms_name} alarm GPSDisconneted"
alarm_modifypwdintime:
name: "${bms_name} alarm ModifyPWDinTime"
alarm_dischargeonfailed:
name: "${bms_name} alarm DischargeOnFailed"
alarm_batteryovertemp:
name: "${bms_name} alarm BatteryOverTemp"
alarm_temperaturesensoranomaly:
name: "${bms_name} alarm TemperatureSensorAnomaly"
alarm_plcmoduleanomaly:
name: "${bms_name} alarm PLCModuleAnomaly"
alarm_mostempsensorabsent:
name: "${bms_name} alarm MOSTempSensorAbsent"
alarm_battempsensor1absent:
name: "${bms_name} alarm BATTempSensor1Absent"
alarm_battempsensor2absent:
name: "${bms_name} alarm BATTempSensor2Absent"
alarm_battempsensor3absent:
name: "${bms_name} alarm BATTempSensor3Absent"
alarm_battempsensor4absent:
name: "${bms_name} alarm BATTempSensor4Absent"
alarm_battempsensor5absent:
name: "${bms_name} alarm BATTempSensor5Absent"
button:
- platform: jk_bms_ble
retrieve_settings:
name: "${bms_name} retrieve settings"
retrieve_device_info:
name: "${bms_name} retrieve device info"
number:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
cell_smart_sleep_voltage:
name: "${bms_name} cell smart sleep voltage"
cell_undervoltage_protection:
name: "${bms_name} cell undervoltage protection"
cell_undervoltage_protection_recovery:
name: "${bms_name} cell undervoltage protection recovery"
cell_overvoltage_protection:
name: "${bms_name} cell overvoltage protection"
cell_overvoltage_protection_recovery:
name: "${bms_name} cell overvoltage protection recovery"
balance_trigger_voltage:
name: "${bms_name} balance trigger voltage"
cell_soc100_voltage:
name: "${bms_name} cell_soc100 voltage"
cell_soc0_voltage:
name: "${bms_name} cell_soc0 voltage"
cell_request_charge_voltage:
name: "${bms_name} cell request charge voltage"
cell_request_float_voltage:
name: "${bms_name} cell request float voltage"
cell_request_charge_voltage_time:
name: "${bms_name} cell request charge voltage time"
cell_request_float_voltage_time:
name: "${bms_name} cell request float voltage time"
cell_count:
name: "${bms_name} cell count"
total_battery_capacity:
name: "${bms_name} total battery capacity"
balance_starting_voltage:
name: "${bms_name} balance starting voltage"
voltage_calibration:
name: "${bms_name} voltage calibration"
current_calibration:
name: "${bms_name} current calibration"
cell_power_off_voltage:
name: "${bms_name} cell power off voltage"
max_balance_current:
name: "${bms_name} max balance current"
max_charge_current:
name: "${bms_name} max charge current"
max_discharge_current:
name: "${bms_name} max discharge current"
smart_sleep_time:
name: "${bms_name} smart sleep time"
uart1_protocol_number:
name: "${bms_name} uart1 protocol number"
uart2_protocol_number:
name: "${bms_name} uart2 protocol number"
sensor:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balancing_direction:
name: "${bms_name} balancing direction"
cell_voltage_min:
name: "${bms_name} cell voltage min"
cell_voltage_max:
name: "${bms_name} cell voltage max"
cell_voltage_min_cell_number:
name: "${bms_name} cell voltage min cell number"
cell_voltage_max_cell_number:
name: "${bms_name} cell voltage max cell number"
delta_cell_voltage:
name: "${bms_name} delta cell voltage"
average_cell_voltage:
name: "${bms_name} average cell voltage"
cell_voltage_01:
name: "${bms_name} cell voltage 01"
cell_voltage_02:
name: "${bms_name} cell voltage 02"
cell_voltage_03:
name: "${bms_name} cell voltage 03"
cell_voltage_04:
name: "${bms_name} cell voltage 04"
cell_voltage_05:
name: "${bms_name} cell voltage 05"
cell_voltage_06:
name: "${bms_name} cell voltage 06"
cell_voltage_07:
name: "${bms_name} cell voltage 07"
cell_voltage_08:
name: "${bms_name} cell voltage 08"
cell_voltage_09:
name: "${bms_name} cell voltage 09"
cell_voltage_10:
name: "${bms_name} cell voltage 10"
cell_voltage_11:
name: "${bms_name} cell voltage 11"
cell_voltage_12:
name: "${bms_name} cell voltage 12"
cell_voltage_13:
name: "${bms_name} cell voltage 13"
cell_voltage_14:
name: "${bms_name} cell voltage 14"
cell_voltage_15:
name: "${bms_name} cell voltage 15"
cell_voltage_16:
name: "${bms_name} cell voltage 16"
cell_voltage_17:
name: "${bms_name} cell voltage 17"
cell_voltage_18:
name: "${bms_name} cell voltage 18"
cell_voltage_19:
name: "${bms_name} cell voltage 19"
cell_voltage_20:
name: "${bms_name} cell voltage 20"
cell_voltage_21:
name: "${bms_name} cell voltage 21"
cell_voltage_22:
name: "${bms_name} cell voltage 22"
cell_voltage_23:
name: "${bms_name} cell voltage 23"
cell_voltage_24:
name: "${bms_name} cell voltage 24"
cell_resistance_01:
name: "${bms_name} cell resistance 01"
cell_resistance_02:
name: "${bms_name} cell resistance 02"
cell_resistance_03:
name: "${bms_name} cell resistance 03"
cell_resistance_04:
name: "${bms_name} cell resistance 04"
cell_resistance_05:
name: "${bms_name} cell resistance 05"
cell_resistance_06:
name: "${bms_name} cell resistance 06"
cell_resistance_07:
name: "${bms_name} cell resistance 07"
cell_resistance_08:
name: "${bms_name} cell resistance 08"
cell_resistance_09:
name: "${bms_name} cell resistance 09"
cell_resistance_10:
name: "${bms_name} cell resistance 10"
cell_resistance_11:
name: "${bms_name} cell resistance 11"
cell_resistance_12:
name: "${bms_name} cell resistance 12"
cell_resistance_13:
name: "${bms_name} cell resistance 13"
cell_resistance_14:
name: "${bms_name} cell resistance 14"
cell_resistance_15:
name: "${bms_name} cell resistance 15"
cell_resistance_16:
name: "${bms_name} cell resistance 16"
cell_resistance_17:
name: "${bms_name} cell resistance 17"
cell_resistance_18:
name: "${bms_name} cell resistance 18"
cell_resistance_19:
name: "${bms_name} cell resistance 19"
cell_resistance_20:
name: "${bms_name} cell resistance 20"
cell_resistance_21:
name: "${bms_name} cell resistance 21"
cell_resistance_22:
name: "${bms_name} cell resistance 22"
cell_resistance_23:
name: "${bms_name} cell resistance 23"
cell_resistance_24:
name: "${bms_name} cell resistance 24"
total_voltage:
name: "${bms_name} total voltage"
current:
name: "${bms_name} current"
power:
name: "${bms_name} power"
charging_power:
name: "${bms_name} charging power"
discharging_power:
name: "${bms_name} discharging power"
temperature_sensor_1:
name: "${bms_name} temperature sensor 1"
temperature_sensor_2:
name: "${bms_name} temperature sensor 2"
temperature_sensor_3:
name: "${bms_name} temperature sensor 3"
temperature_sensor_4:
name: "${bms_name} temperature sensor 4"
power_tube_temperature:
name: "${bms_name} power tube temperature"
state_of_charge:
name: "${bms_name} state of charge"
capacity_remaining:
name: "${bms_name} capacity remaining"
total_battery_capacity_setting:
name: "${bms_name} total battery capacity setting"
charging_cycles:
name: "${bms_name} charging cycles"
total_charging_cycle_capacity:
name: "${bms_name} total charging cycle capacity"
total_runtime:
name: "${bms_name} total runtime"
balancing_current:
name: "${bms_name} balancing current"
errors_bitmask:
name: "${bms_name} errors bitmask"
heating_current:
name: "${bms_name} heating current"
switch:
- platform: jk_bms_ble
charging:
name: "${bms_name} charging"
discharging:
name: "${bms_name} discharging"
balancer:
name: "${bms_name} balancer"
display_always_on:
name: "${bms_name} display always on"
heating:
name: "${bms_name} heating"
emergency:
name: "${bms_name} emergency"
charging_float_mode:
name: "${bms_name} charging float mode"
timed_stored_data:
name: "${bms_name} timed stored data"
disable_temperature_sensors:
name: "${bms_name} disable temperature sensors"
smart_sleep_on:
name: "${bms_name} smart sleep on"
disable_pcl_module:
name: "${bms_name} disable pcl module"
- platform: ble_client
ble_client_id: ble_client0
id: ble_client_switch0
name: "${bms_name} enable bluetooth connection"
text_sensor:
- platform: jk_bms_ble
errors:
name: "${bms_name} errors"
total_runtime_formatted:
name: "${bms_name} total runtime formatted"
info_vendorid:
name: "${bms_name} info vendorid"
info_hardware_version:
name: "${bms_name} info hardware version"
info_software_version:
name: "${bms_name} info software version"
info_device_name:
name: "${bms_name} info device name"
info_device_password:
name: "${bms_name} info device password"