Skip to content

Commit 2ecec57

Browse files
committed
Throttle Deye sensors
Deye sensors were updated with each CAN message. Add throttle filter using ${bms_update_interval}.
1 parent 853f79e commit 2ecec57

File tree

4 files changed

+150
-34
lines changed

4 files changed

+150
-34
lines changed

packages/bms/bms_sensors_DEYE_CAN_module_full.yaml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Updated : 2026.02.05
2-
# Version : 1.1.10
1+
# Updated : 2026.02.21
2+
# Version : 1.1.11
33
# GitHub : https://github.com/GHswitt/esphome-yambms
44

55
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -309,9 +309,10 @@ sensor:
309309
state_class: 'measurement'
310310
accuracy_decimals: 2
311311
filters:
312-
- timeout:
313-
timeout: 60s
314-
value: !lambda return 0;
312+
- timeout:
313+
timeout: 60s
314+
value: !lambda return 0;
315+
- throttle: ${bms_update_interval}
315316

316317
# Current
317318
- platform: template
@@ -322,6 +323,8 @@ sensor:
322323
device_class: 'current'
323324
state_class: 'measurement'
324325
accuracy_decimals: 1
326+
filters:
327+
- throttle: ${bms_update_interval}
325328

326329
# Battery power (calculated)
327330
- platform: template
@@ -334,6 +337,8 @@ sensor:
334337
accuracy_decimals: 0
335338
lambda: |-
336339
return id(bms${bms_id}_total_voltage).state * id(bms${bms_id}_current).state;
340+
filters:
341+
- throttle: ${bms_update_interval}
337342

338343
# Charging power: Calculated from voltage and current
339344
- platform: template
@@ -347,6 +352,8 @@ sensor:
347352
lambda: |-
348353
if (id(bms${bms_id}_current).state > 0) return id(bms${bms_id}_total_voltage).state * id(bms${bms_id}_current).state;
349354
else return 0;
355+
filters:
356+
- throttle: ${bms_update_interval}
350357

351358
# Discharging power: Calculated from voltage and current
352359
- platform: template
@@ -360,6 +367,8 @@ sensor:
360367
lambda: |-
361368
if (id(bms${bms_id}_current).state < 0) return id(bms${bms_id}_total_voltage).state * -id(bms${bms_id}_current).state;
362369
else return 0;
370+
filters:
371+
- throttle: ${bms_update_interval}
363372

364373
# SoC
365374
- platform: template
@@ -370,6 +379,8 @@ sensor:
370379
device_class: 'battery'
371380
state_class: 'measurement'
372381
accuracy_decimals: 1
382+
filters:
383+
- throttle: ${bms_update_interval}
373384

374385
# Battery capacity
375386
- platform: template
@@ -384,6 +395,8 @@ sensor:
384395
uint8_t module_count = id(deye${deye_id}_module_amount).state;
385396
if (module_count < 1) module_count = 1;
386397
return id(deye${deye_id}_battery_capacity).state / module_count;
398+
filters:
399+
- throttle: ${bms_update_interval}
387400

388401
# Remaining capacity - Calculated from SoC and battery capacity
389402
- platform: template
@@ -396,7 +409,7 @@ sensor:
396409
accuracy_decimals: 0
397410
filters:
398411
- or:
399-
- throttle: 10s
412+
- throttle: ${bms_update_interval}
400413
- delta: 1
401414
lambda: |-
402415
return (id(bms${bms_id}_state_of_charge).state * id(bms${bms_id}_battery_capacity).state) / 100;
@@ -429,7 +442,7 @@ sensor:
429442
- delta: 1
430443
lambda: |-
431444
return id(bms${bms_id}_charging_cycles_raw).state * id(bms${bms_id}_battery_capacity).state;
432-
445+
433446
# Max. charge current
434447
- platform: template
435448
name: "max charge current"
@@ -439,6 +452,8 @@ sensor:
439452
device_class: 'current'
440453
state_class: 'measurement'
441454
accuracy_decimals: 0
455+
filters:
456+
- throttle: ${bms_update_interval}
442457

443458
# Max. discharge current
444459
- platform: template
@@ -449,6 +464,8 @@ sensor:
449464
device_class: 'current'
450465
state_class: 'measurement'
451466
accuracy_decimals: 0
467+
filters:
468+
- throttle: ${bms_update_interval}
452469

453470
# Max. cell voltage
454471
- platform: template
@@ -459,6 +476,8 @@ sensor:
459476
device_class: 'voltage'
460477
state_class: 'measurement'
461478
accuracy_decimals: 3
479+
filters:
480+
- throttle: ${bms_update_interval}
462481

463482
# Max. voltage cell: Only with InterCAN enabled
464483
- platform: template
@@ -481,6 +500,8 @@ sensor:
481500
on_value:
482501
then:
483502
- component.update: bms${bms_id}_imbalance
503+
filters:
504+
- throttle: ${bms_update_interval}
484505

485506
# Min. voltage cell: Only with InterCAN enabled
486507
- platform: template
@@ -500,6 +521,12 @@ sensor:
500521
device_class: 'temperature'
501522
state_class: 'measurement'
502523
accuracy_decimals: 1
524+
filters:
525+
- exponential_moving_average:
526+
alpha: 0.1
527+
send_every: 4
528+
- delta: 1
529+
- throttle: ${bms_update_interval}
503530

504531
# Min. temperature sensor (fixed)
505532
- platform: template
@@ -521,6 +548,12 @@ sensor:
521548
device_class: 'temperature'
522549
state_class: 'measurement'
523550
accuracy_decimals: 1
551+
filters:
552+
- exponential_moving_average:
553+
alpha: 0.1
554+
send_every: 4
555+
- delta: 1
556+
- throttle: ${bms_update_interval}
524557

525558
# Max. temperature sensor (fixed)
526559
- platform: template
@@ -673,7 +706,7 @@ sensor:
673706
state_class: 'total_increasing'
674707
accuracy_decimals: 3
675708
filters:
676-
- throttle: 1s
709+
- throttle: ${bms_update_interval}
677710

678711
- platform: template
679712
name: "discharged"
@@ -684,7 +717,7 @@ sensor:
684717
state_class: 'total_increasing'
685718
accuracy_decimals: 3
686719
filters:
687-
- throttle: 1s
720+
- throttle: ${bms_update_interval}
688721

689722
- platform: template
690723
id: "bms${bms_id}_operation_mode_internal"

packages/bms/bms_sensors_DEYE_CAN_module_minimal.yaml

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Updated : 2026.02.05
2-
# Version : 1.1.10
1+
# Updated : 2026.02.21
2+
# Version : 1.1.11
33
# GitHub : https://github.com/GHswitt/esphome-yambms
44

55
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -166,9 +166,10 @@ sensor:
166166
state_class: 'measurement'
167167
accuracy_decimals: 2
168168
filters:
169-
- timeout:
170-
timeout: 60s
171-
value: !lambda return 0;
169+
- timeout:
170+
timeout: 60s
171+
value: !lambda return 0;
172+
- throttle: ${bms_update_interval}
172173

173174
# Current
174175
- platform: template
@@ -179,6 +180,8 @@ sensor:
179180
device_class: 'current'
180181
state_class: 'measurement'
181182
accuracy_decimals: 1
183+
filters:
184+
- throttle: ${bms_update_interval}
182185

183186
# Battery power (calculated)
184187
- platform: template
@@ -191,6 +194,8 @@ sensor:
191194
accuracy_decimals: 0
192195
lambda: |-
193196
return id(bms${bms_id}_total_voltage).state * id(bms${bms_id}_current).state;
197+
filters:
198+
- throttle: ${bms_update_interval}
194199

195200
# Charging power: Calculated from voltage and current
196201
- platform: template
@@ -204,6 +209,8 @@ sensor:
204209
lambda: |-
205210
if (id(bms${bms_id}_current).state > 0) return id(bms${bms_id}_total_voltage).state * id(bms${bms_id}_current).state;
206211
else return 0;
212+
filters:
213+
- throttle: ${bms_update_interval}
207214

208215
# Discharging power: Calculated from voltage and current
209216
- platform: template
@@ -217,6 +224,8 @@ sensor:
217224
lambda: |-
218225
if (id(bms${bms_id}_current).state < 0) return id(bms${bms_id}_total_voltage).state * -id(bms${bms_id}_current).state;
219226
else return 0;
227+
filters:
228+
- throttle: ${bms_update_interval}
220229

221230
# SoC
222231
- platform: template
@@ -227,6 +236,8 @@ sensor:
227236
device_class: 'battery'
228237
state_class: 'measurement'
229238
accuracy_decimals: 1
239+
filters:
240+
- throttle: ${bms_update_interval}
230241

231242
# Battery capacity
232243
- platform: template
@@ -241,22 +252,24 @@ sensor:
241252
uint8_t module_count = id(deye${deye_id}_module_amount).state;
242253
if (module_count < 1) module_count = 1;
243254
return id(deye${deye_id}_battery_capacity).state / module_count;
255+
filters:
256+
- throttle: ${bms_update_interval}
244257

245-
# Remaining capacity: Calculated from capacity and SoC
258+
# Remaining capacity - Calculated from SoC and battery capacity
246259
- platform: template
260+
# name: "battery capacity remaining"
261+
id: bms${bms_id}_capacity_remaining_ah
262+
device_id: bms_${bms_id}
247263
unit_of_measurement: 'Ah'
248264
device_class: 'battery'
249265
state_class: 'measurement'
250266
accuracy_decimals: 0
251-
id: bms${bms_id}_capacity_remaining_ah
252-
device_id: bms_${bms_id}
253-
# name: "battery capacity remaining"
254-
lambda: |-
255-
return (id(bms${bms_id}_state_of_charge).state * id(bms${bms_id}_battery_capacity).state) / 100;
256267
filters:
257268
- or:
258-
- throttle: 10s
269+
- throttle: ${bms_update_interval}
259270
- delta: 1
271+
lambda: |-
272+
return (id(bms${bms_id}_state_of_charge).state * id(bms${bms_id}_battery_capacity).state) / 100;
260273
261274
# Charging cycles
262275
- platform: template
@@ -296,6 +309,8 @@ sensor:
296309
device_class: 'current'
297310
state_class: 'measurement'
298311
accuracy_decimals: 0
312+
filters:
313+
- throttle: ${bms_update_interval}
299314

300315
# Max. discharge current
301316
- platform: template
@@ -306,6 +321,8 @@ sensor:
306321
device_class: 'current'
307322
state_class: 'measurement'
308323
accuracy_decimals: 0
324+
filters:
325+
- throttle: ${bms_update_interval}
309326

310327
# Max. cell voltage
311328
- platform: template
@@ -316,6 +333,8 @@ sensor:
316333
device_class: 'voltage'
317334
state_class: 'measurement'
318335
accuracy_decimals: 3
336+
filters:
337+
- throttle: ${bms_update_interval}
319338

320339
# Max. voltage cell: Only with InterCAN enabled
321340
- platform: template
@@ -324,8 +343,7 @@ sensor:
324343
id: bms${bms_id}_max_voltage_cell
325344
device_id: bms_${bms_id}
326345
name: "cell voltage max cell number"
327-
filters:
328-
- lambda: return 0;
346+
lambda: return 0;
329347

330348
# Min. cell voltage
331349
- platform: template
@@ -339,6 +357,8 @@ sensor:
339357
on_value:
340358
then:
341359
- component.update: bms${bms_id}_imbalance
360+
filters:
361+
- throttle: ${bms_update_interval}
342362

343363
# Min. voltage cell: Only with InterCAN enabled
344364
- platform: template
@@ -347,8 +367,7 @@ sensor:
347367
id: bms${bms_id}_min_voltage_cell
348368
device_id: bms_${bms_id}
349369
name: "cell voltage min cell number"
350-
filters:
351-
- lambda: return 0;
370+
lambda: return 0;
352371

353372
# Min. temperature
354373
- platform: template
@@ -359,6 +378,12 @@ sensor:
359378
device_class: 'temperature'
360379
state_class: 'measurement'
361380
accuracy_decimals: 1
381+
filters:
382+
- exponential_moving_average:
383+
alpha: 0.1
384+
send_every: 4
385+
- delta: 1
386+
- throttle: ${bms_update_interval}
362387

363388
# Min. temperature sensor (fixed)
364389
- platform: template
@@ -380,6 +405,12 @@ sensor:
380405
device_class: 'temperature'
381406
state_class: 'measurement'
382407
accuracy_decimals: 1
408+
filters:
409+
- exponential_moving_average:
410+
alpha: 0.1
411+
send_every: 4
412+
- delta: 1
413+
- throttle: ${bms_update_interval}
383414

384415
# Max. temperature sensor (fixed)
385416
- platform: template
@@ -395,6 +426,7 @@ sensor:
395426
# Cell OVP: Unsupported
396427
- platform: template
397428
unit_of_measurement: 'V'
429+
device_class: 'voltage'
398430
state_class: 'measurement'
399431
accuracy_decimals: 2
400432
id: bms${bms_id}_cell_ovp
@@ -406,6 +438,7 @@ sensor:
406438
# Cell UVP: Unsupported
407439
- platform: template
408440
unit_of_measurement: 'V'
441+
device_class: 'voltage'
409442
state_class: 'measurement'
410443
accuracy_decimals: 2
411444
id: bms${bms_id}_cell_uvp
@@ -417,6 +450,7 @@ sensor:
417450
# Cell balance trigger voltage: Unsupported
418451
- platform: template
419452
unit_of_measurement: 'V'
453+
device_class: 'voltage'
420454
state_class: 'measurement'
421455
accuracy_decimals: 2
422456
id: bms${bms_id}_bms_balance_trigger_voltage
@@ -455,7 +489,7 @@ sensor:
455489
state_class: 'total_increasing'
456490
accuracy_decimals: 3
457491
filters:
458-
- throttle: 1s
492+
- throttle: ${bms_update_interval}
459493

460494
- platform: template
461495
name: "discharged"
@@ -466,7 +500,7 @@ sensor:
466500
state_class: 'total_increasing'
467501
accuracy_decimals: 3
468502
filters:
469-
- throttle: 1s
503+
- throttle: ${bms_update_interval}
470504

471505
text_sensor:
472506
- platform: template

0 commit comments

Comments
 (0)