forked from syssi/esphome-jk-bms
-
Notifications
You must be signed in to change notification settings - Fork 8
/
esp32-ble-v11-old-style-example.yaml
312 lines (294 loc) · 9.04 KB
/
esp32-ble-v11-old-style-example.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
substitutions:
name: jk-bms
device_description: "Monitor and control a JK-BMS v11 via bluetooth"
external_components_source: github://syssi/esphome-jk-bms@main
mac_address: C8:47:8C:E1:E2:E1
# Please use "JK02_24S" if you own a old JK-BMS < hardware version 11.0 (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_24S
esphome:
name: ${name}
comment: ${device_description}
project:
name: "syssi.esphome-jk-bms"
version: 2.0.0
esp32:
board: wemos_d1_mini32
framework:
type: esp-idf
external_components:
- source: ${external_components_source}
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"
logger:
level: 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
esp32_ble_tracker:
on_ble_advertise:
then:
- lambda: |-
if (x.get_name().rfind("JK-", 0) == 0 || 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: client0
jk_bms_ble:
- ble_client_id: client0
protocol_version: ${protocol_version}
throttle: 5s
id: bms0
binary_sensor:
- platform: jk_bms_ble
balancing:
name: "${name} balancing"
charging:
name: "${name} charging"
discharging:
name: "${name} discharging"
heating:
name: "${name} heating"
online_status:
name: "${name} online status"
button:
- platform: jk_bms_ble
retrieve_settings:
name: "${name} retrieve settings"
retrieve_device_info:
name: "${name} retrieve device info"
number:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balance_trigger_voltage:
name: "${name} balance trigger voltage"
cell_count:
name: "${name} cell count"
total_battery_capacity:
name: "${name} total battery capacity"
cell_voltage_overvoltage_protection:
name: "${name} cell voltage overvoltage protection"
cell_voltage_overvoltage_recovery:
name: "${name} cell voltage overvoltage recovery"
cell_voltage_undervoltage_protection:
name: "${name} cell voltage undervoltage protection"
cell_voltage_undervoltage_recovery:
name: "${name} cell voltage undervoltage recovery"
balance_starting_voltage:
name: "${name} balance starting voltage"
voltage_calibration:
name: "${name} voltage calibration"
current_calibration:
name: "${name} current calibration"
power_off_voltage:
name: "${name} power off voltage"
max_balance_current:
name: "${name} max balance current"
max_charge_current:
name: "${name} max charge current"
max_discharge_current:
name: "${name} max discharge current"
sensor:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
cell_voltage_min:
name: "${name} cell voltage min"
cell_voltage_max:
name: "${name} cell voltage max"
cell_voltage_min_cell_number:
name: "${name} cell voltage min cell number"
cell_voltage_max_cell_number:
name: "${name} cell voltage max cell number"
delta_cell_voltage:
name: "${name} delta cell voltage"
average_cell_voltage:
name: "${name} average cell voltage"
cell_voltage_1:
name: "${name} cell voltage 1"
cell_voltage_2:
name: "${name} cell voltage 2"
cell_voltage_3:
name: "${name} cell voltage 3"
cell_voltage_4:
name: "${name} cell voltage 4"
cell_voltage_5:
name: "${name} cell voltage 5"
cell_voltage_6:
name: "${name} cell voltage 6"
cell_voltage_7:
name: "${name} cell voltage 7"
cell_voltage_8:
name: "${name} cell voltage 8"
cell_voltage_9:
name: "${name} cell voltage 9"
cell_voltage_10:
name: "${name} cell voltage 10"
cell_voltage_11:
name: "${name} cell voltage 11"
cell_voltage_12:
name: "${name} cell voltage 12"
cell_voltage_13:
name: "${name} cell voltage 13"
cell_voltage_14:
name: "${name} cell voltage 14"
cell_voltage_15:
name: "${name} cell voltage 15"
cell_voltage_16:
name: "${name} cell voltage 16"
cell_voltage_17:
name: "${name} cell voltage 17"
cell_voltage_18:
name: "${name} cell voltage 18"
cell_voltage_19:
name: "${name} cell voltage 19"
cell_voltage_20:
name: "${name} cell voltage 20"
cell_voltage_21:
name: "${name} cell voltage 21"
cell_voltage_22:
name: "${name} cell voltage 22"
cell_voltage_23:
name: "${name} cell voltage 23"
cell_voltage_24:
name: "${name} cell voltage 24"
cell_resistance_1:
name: "${name} cell resistance 1"
cell_resistance_2:
name: "${name} cell resistance 2"
cell_resistance_3:
name: "${name} cell resistance 3"
cell_resistance_4:
name: "${name} cell resistance 4"
cell_resistance_5:
name: "${name} cell resistance 5"
cell_resistance_6:
name: "${name} cell resistance 6"
cell_resistance_7:
name: "${name} cell resistance 7"
cell_resistance_8:
name: "${name} cell resistance 8"
cell_resistance_9:
name: "${name} cell resistance 9"
cell_resistance_10:
name: "${name} cell resistance 10"
cell_resistance_11:
name: "${name} cell resistance 11"
cell_resistance_12:
name: "${name} cell resistance 12"
cell_resistance_13:
name: "${name} cell resistance 13"
cell_resistance_14:
name: "${name} cell resistance 14"
cell_resistance_15:
name: "${name} cell resistance 15"
cell_resistance_16:
name: "${name} cell resistance 16"
cell_resistance_17:
name: "${name} cell resistance 17"
cell_resistance_18:
name: "${name} cell resistance 18"
cell_resistance_19:
name: "${name} cell resistance 19"
cell_resistance_20:
name: "${name} cell resistance 20"
cell_resistance_21:
name: "${name} cell resistance 21"
cell_resistance_22:
name: "${name} cell resistance 22"
cell_resistance_23:
name: "${name} cell resistance 23"
cell_resistance_24:
name: "${name} cell resistance 24"
total_voltage:
name: "${name} total voltage"
current:
name: "${name} current"
heating_current:
name: "${name} heating current"
power:
name: "${name} power"
charging_power:
name: "${name} charging power"
discharging_power:
name: "${name} discharging power"
temperature_sensor_1:
name: "${name} temperature sensor 1"
temperature_sensor_2:
name: "${name} temperature sensor 2"
temperature_sensor_3:
name: "${name} temperature sensor 3"
temperature_sensor_4:
name: "${name} temperature sensor 4"
power_tube_temperature:
name: "${name} power tube temperature"
state_of_charge:
name: "${name} state of charge"
capacity_remaining:
name: "${name} capacity remaining"
total_battery_capacity_setting:
name: "${name} total battery capacity setting"
charging_cycles:
name: "${name} charging cycles"
total_charging_cycle_capacity:
name: "${name} total charging cycle capacity"
total_runtime:
name: "${name} total runtime"
balancing_current:
name: "${name} balancing current"
errors_bitmask:
name: "${name} errors bitmask"
emergency_time_countdown:
name: "${name} emergency time countdown"
switch:
- platform: jk_bms_ble
charging:
name: "${name} charging"
discharging:
name: "${name} discharging"
balancer:
name: "${name} balancer"
emergency:
name: "${name} emergency"
heating:
name: "${name} heating"
disable_temperature_sensors:
name: "${name} disable temperature sensors"
display_always_on:
name: "${name} display always on"
smart_sleep:
name: "${name} smart sleep"
disable_pcl_module:
name: "${name} disable pcl module"
timed_stored_data:
name: "${name} timed stored data"
charging_float_mode:
name: "${name} charging float mode"
- platform: ble_client
ble_client_id: client0
id: ble_client_switch0
name: "${name} enable bluetooth connection"
text_sensor:
- platform: jk_bms_ble
errors:
name: "${name} errors"
total_runtime_formatted:
name: "${name} total runtime formatted"