-
-
Notifications
You must be signed in to change notification settings - Fork 172
/
esp32-ble-example-multiple-devices.yaml
212 lines (188 loc) · 5.09 KB
/
esp32-ble-example-multiple-devices.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
substitutions:
name: jk-bms
bms0: "${name} bms0"
bms1: "${name} bms1"
device_description: "Monitor and control a JK-BMS via bluetooth"
external_components_source: github://syssi/esphome-jk-bms@main
bms0_mac_address: C8:47:8C:E1:E2:AA
bms1_mac_address: C8:47:8C:E1:E2:BB
# 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)
bms0_protocol_version: JK02_32S
bms1_protocol_version: JK02_32S
esphome:
name: ${name}
comment: ${device_description}
min_version: 2024.6.0
project:
name: "syssi.esphome-jk-bms"
version: 2.1.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:
platform: esphome
on_begin:
then:
- switch.turn_off: ble_client_switch0
- switch.turn_off: ble_client_switch1
- logger.log: "BLE connection suspended for OTA update"
logger:
level: DEBUG
logs:
esp32_ble_tracker: INFO
esp32_ble_client: INFO
# 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:
scan_parameters:
active: false
ble_client:
- mac_address: ${bms0_mac_address}
id: client0
- mac_address: ${bms1_mac_address}
id: client1
jk_bms_ble:
- ble_client_id: client0
protocol_version: ${bms0_protocol_version}
throttle: 5s
id: bms0
- ble_client_id: client1
protocol_version: ${bms1_protocol_version}
throttle: 5s
id: bms1
binary_sensor:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balancing:
name: "${bms0} balancing"
charging:
name: "${bms0} charging"
discharging:
name: "${bms0} discharging"
online_status:
name: "${bms0} online status"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
balancing:
name: "${bms1} balancing"
charging:
name: "${bms1} charging"
discharging:
name: "${bms1} discharging"
online_status:
name: "${bms1} online status"
button:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
retrieve_settings:
name: "${bms0} retrieve settings"
retrieve_device_info:
name: "${bms0} retrieve device info"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
retrieve_settings:
name: "${bms1} retrieve settings"
retrieve_device_info:
name: "${bms1} retrieve device info"
number:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balance_trigger_voltage:
name: "${bms0} balance trigger voltage"
balance_starting_voltage:
name: "${bms0} balance starting voltage"
power_off_voltage:
name: "${bms0} power off voltage"
# ...
- platform: jk_bms_ble
jk_bms_ble_id: bms1
balance_trigger_voltage:
name: "${bms1} balance trigger voltage"
balance_starting_voltage:
name: "${bms1} balance starting voltage"
power_off_voltage:
name: "${bms1} power off voltage"
# ...
sensor:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
delta_cell_voltage:
name: "${bms0} delta cell voltage"
average_cell_voltage:
name: "${bms0} average cell voltage"
total_voltage:
name: "${bms0} total voltage"
current:
name: "${bms0} current"
power:
name: "${bms0} power"
power_tube_temperature:
name: "${bms0} power tube temperature"
# ...
- platform: jk_bms_ble
jk_bms_ble_id: bms1
delta_cell_voltage:
name: "${bms1} delta cell voltage"
average_cell_voltage:
name: "${bms1} average cell voltage"
total_voltage:
name: "${bms1} total voltage"
current:
name: "${bms1} current"
power:
name: "${bms1} power"
power_tube_temperature:
name: "${bms1} power tube temperature"
# ...
switch:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
charging:
name: "${bms0} charging"
discharging:
name: "${bms0} discharging"
balancer:
name: "${bms0} balancer"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
charging:
name: "${bms1} charging"
discharging:
name: "${bms1} discharging"
balancer:
name: "${bms1} balancer"
- platform: ble_client
ble_client_id: client0
id: ble_client_switch0
name: "${bms0} enable bluetooth connection"
- platform: ble_client
ble_client_id: client1
id: ble_client_switch1
name: "${bms1} enable bluetooth connection"
text_sensor:
- platform: jk_bms_ble
jk_bms_ble_id: bms0
errors:
name: "${bms0} errors"
total_runtime_formatted:
name: "${bms0} total runtime formatted"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
errors:
name: "${bms1} errors"
total_runtime_formatted:
name: "${bms1} total runtime formatted"