Closed Didou30 closed 1 year ago
le code testé en Esphome V 2022.2.5-dev esphome: name: bmsdaly
esp8266: board: esp01_1m
logger:
api:
ota: password: "057e5e176a11c4f5ac1cab965ff9bf6c"
wifi: ssid: !secret ssid password: !secret mp_wifi
ap: ssid: "Bmsdaly Fallback Hotspot" password: "MzJE8fEg3jGy"
captive_portal:
uart: tx_pin: GPIO15 rx_pin: GPIO13 baud_rate: 9600
switch:
daly_bms: update_interval: 20s
sensor:
platform: daly_bms voltage: name: "Battery Voltage" current: name: "Battery Current" battery_level: name: "Battery Level" max_cell_voltage: name: "Max Cell Voltage" max_cell_voltage_number: name: "Max Cell Voltage Number" min_cell_voltage: name: "Min Cell Voltage" min_cell_voltage_number: name: "Min Cell Voltage Number" max_temperature: name: "Max Temperature" max_temperature_probe_number: name: "Max Temperature Probe Number" min_temperature: name: "Min Temperature" min_temperature_probe_number: name: "Min Temperature Probe Number" remaining_capacity: name: "Remaining Capacity" filters:
text_sensor:
binary_sensor:
Anythink for help?
Hey there @s1lvi0, mind taking a look at this issue as it has been labeled with an integration (daly_bms
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
I have the same problem. But after some hours of testing I can say more the reasons. In daly_bms.cpp
void DalyBmsComponent::update() { this->requestdata(DALY_REQUEST_BATTERY_LEVEL); this->requestdata(DALY_REQUEST_MIN_MAX_VOLTAGE); this->requestdata(DALY_REQUEST_MIN_MAX_TEMPERATURE); this->requestdata(DALY_REQUEST_MOS); this->requestdata(DALY_REQUEST_STATUS); this->requestdata(DALY_REQUEST_CELL_VOLTAGE); this->requestdata(DALY_REQUEST_TEMPERATURE);
the update sends several requests to the bms. [18:25:33][D][uart_debug:114]: >>> A5:80:90:08:00:00:00:00:00:00:00:00:BD:A5:80:91:08:00:00:00:00:00:00:00:00:BE:A5:80:92:08:00:00:00:00:00:00:00:00:BF:A5:80:93:08:00:00:00:00:00:00:00:00:C0:A5:80:94:08:00:00:00:00:00:00:00:00:C1:A5:80:95:08:00:00:00:00:00:00:00:00:C2:A5:80:96:08:00:00:00:00:00:00:00:00:C3
After this request you get al lot of bytes back to the serial interface, but not all requested bytes. Is seems like the data-package is cut on start and on the end. First package ist complete on Start (A501...) [18:25:34][D][uart_debug:114]: <<< A5:01:95:08:01:0D:0F:0D:0C:0D:0C:C0:52:A5:01:95:08:02:0D:18:0D:16:0D:19:C0:73:A5:01:95:08:03:0D:15:0D:14:0D:0C:C0:62:A5:01:95:08:04:0D:15:0D:19:0D:0B:C0:67:A5:01:95:08:05:0D:15:0D:11:0D:12:C0:67:A5:01:95:08:06:0D:11:00:00:00:00:C0:27:A5:01:95:08:07:00:00:00:00:00:00:C0:0A:A5:01:95:08:08:00:00:00:00:00:00:C0:0B:A5:01:95:08:09:00:00:00:00:00:00:C0:0C:A5:01:95:08:0A:00:00:00:00:00:00:C0:0D:A5:01:95:08:0B:00:00:00:00:00:00:C0:0E:A5:01:96:08:01:37:00:00:00:00:00:C0:3C:0B:86:74:08:2B:12:DD:2D:19:D1:21:48:FD:90:A1:40:21:48:5B:69:84:80:EE:00:60:C0:52:00:00:00:02:C0:15:05:43:D4:D4:A8:4E
next pakages are cut on start and on End. [18:25:54][D][uart_debug:114]: <<< FD:A5:01:95:08:02:0D:18:0D:16:0D:19:C0:73:A5:01:95:08:03:0D:15:0D:14:0D:0C:C0:62:A5:01:95:08:04:0D:15:0D:19:0D:0A:C0:66:A5:01:95:08:05:0D:15:0D:11:0D:12:C0:67:A5:01:95:08:06:0D:11:00:00:00:00:C0:27:A5:01:95:08:07:00:00:00:00:00:00:C0:0A:A5:01:95:08:08:00:00:00:00:00:00:C0:0B:A5:01:95:08:09:00:00:00:00:00:00:C0:0C:A5:01:95:08:0A:00:00:00:00:00:00:C0:0D:A5:01:95:08:0B:00:00:00:00:00:00:C0:0E:A5:01:96:08:01:37:00:00:00:00:00:C0:3C:41:09:02:54:04:FF:0B:86:94:A8:08:F4:2D:0C:53:20:21:6C:5A:32:A0:40:80:B0:66:65:88:80:00:15:D2:95:0C:0C
If you comment out some request-lines in DalyBmsComponent::update() it works fine. With more than 2 requests per update it beginns to stuck.
If you execute only one request at time, the answers are decoded and published correct.
I tried to rise the UART rx-buffer from 256 to 2048 bytes with no success.
Is it possible to split the requests over several Updates? Only one Request per Update works fast and fine. Next Update next request an so on...
Me 2...not all values were populating from my bms. Specially temp and battery current.
Thanks to the insights from @matthias882, I added
rx_buffer_size: 512
To my UART line and I seem to be receiving all values properly now.
I dont know if that will work in all situations or if its even the right value (who knows if im loosing a few extra bits near the end), but unlike @matthias882 that said it didnt help him (possibly he is on esp8266 which uses soft uart?), it did for me. Im on an ESP32, I only have 8 cells, 1 temp sensor.
Digging further into the daly_bms.cpp update() function its clear that Temp is one of the last requested items, so it makes sense that a buffer of 256 (default) could possibly be loosing the bits related to the last few requested data.
Ive briefly looked thru @matthias882 pull request for a state machine change and overall it looks good. I will see about trying it later. Let me know if there is any way I can help with this issue.
The problem
Ajout des tensions des cellule de 1 à 16 ne fonctionne pas, il ne remonte que la Température
Which version of ESPHome has the issue?
V 2022.2.5-dev
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2022.2.9
What platform are you using?
ESP8266
Board
Wemos D1 mini
Component causing the issue
Daly BMS
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
Fonctionne avec la version Esphome avec Daly BMS:
NFO Reading configuration /config/esphome/bmsdaly.yaml... INFO Starting log output from bmsdaly.local using esphome API INFO Successfully connected to bmsdaly.local [21:01:36][I][app:102]: ESPHome version 2022.2.4 compiled on Feb 23 2022, 11:29:20
[21:01:36][C][wifi:353]: Local MAC: 40:91:51:4F:8F:9E [21:01:36][C][wifi:354]: SSID: 'Livebox-596E'[redacted] [21:01:36][C][wifi:355]: IP Address: 192.168.1.28 [21:01:36][C][wifi:356]: BSSID: E8:1B:69:02:59:6E[redacted]
[21:01:36][C][wifi:360]: Signal strength: -54 dB ▂▄▆█ [21:01:36][C][wifi:364]: Channel: 1 [21:01:36][C][wifi:365]: Subnet: 255.255.255.0 [21:01:36][C][wifi:366]: Gateway: 192.168.1.1 [21:01:36][C][wifi:367]: DNS1: 192.168.1.1 [21:01:36][C][wifi:368]: DNS2: 0.0.0.0
[21:01:36][C][logger:234]: Level: DEBUG [21:01:36][C][logger:235]: Log Baud Rate: 115200 [21:01:36][C][logger:236]: Hardware UART: UART0 [21:01:36][C][uart.arduino_esp8266:102]: UART Bus: [21:01:36][C][uart.arduino_esp8266:103]: TX Pin: GPIO15 [21:01:36][C][uart.arduino_esp8266:104]: RX Pin: GPIO13 [21:01:36][C][uart.arduino_esp8266:106]: RX Buffer Size: 256 [21:01:36][C][uart.arduino_esp8266:108]: Baud Rate: 9600 baud [21:01:36][C][uart.arduino_esp8266:109]: Data Bits: 8 [21:01:36][C][uart.arduino_esp8266:110]: Parity: NONE [21:01:36][C][uart.arduino_esp8266:111]: Stop bits: 1 [21:01:36][C][uart.arduino_esp8266:115]: Using software serial [21:01:36][C][restart:022]: Restart Switch 'bms_daly_restart'
[21:01:36][C][daly_bms:024]: Daly BMS: [21:01:36][C][captive_portal:144]: Captive Portal:
[21:01:36][C][mdns:085]: Hostname: bmsdaly [21:01:36][C][ota:085]: Over-The-Air Updates: [21:01:36][C][ota:086]: Address: bmsdaly.local:8266 [21:01:36][C][ota:089]: Using Password. [21:01:36][C][api:138]: API Server: [21:01:36][C][api:139]: Address: bmsdaly.local:6053 [21:01:36][C][api:143]: Using noise encryption: NO [21:01:36][C][wifi_signal.sensor:009]: WiFi Signal 'WiFi puissance_BMS_Daly' [21:01:36][C][wifi_signal.sensor:009]: Device Class: 'signal_strength' [21:01:36][C][wifi_signal.sensor:009]: State Class: 'measurement' [21:01:36][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm' [21:01:36][C][wifi_signal.sensor:009]: Accuracy Decimals: 0 [21:01:43][D][sensor:124]: 'Max Cell Voltage': Sending state 3.32200 V with 2 decimals of accuracy [21:01:43][D][sensor:124]: 'Max Cell Voltage Number': Sending state 13.00000 with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Min Cell Voltage': Sending state 3.31500 V with 2 decimals of accuracy [21:01:43][D][sensor:124]: 'Min Cell Voltage Number': Sending state 1.00000 with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Max Temperature': Sending state 13.00000 °C with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Max Temperature Probe Number': Sending state 1.00000 with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Min Temperature': Sending state 13.00000 °C with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Min Temperature Probe Number': Sending state 1.00000 with 0 decimals of accuracy [21:01:43][D][text_sensor:067]: 'BMS Status': Sending state 'Discharging' [21:01:43][D][sensor:124]: 'Remaining Capacity': Sending state 6.93360 Ah with 2 decimals of accuracy [21:01:43][D][sensor:124]: 'Cells Number': Sending state 16.00000 with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Temperature 1': Sending state 13.00000 °C with 0 decimals of accuracy [21:01:43][D][sensor:124]: 'Temperature 2': Sending state -40.00000 °C with 0 decimals of accuracy [21:01:47][D][sensor:124]: 'WiFi puissance_BMS_Daly': Sending state -56.00000 dBm with 0 decimals of accuracy