-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support TopBand Batteries #194
Comments
IOS BT Packet Logs available here. |
Hi @Fandu21! Looks like an Ective BMS, so implementation exists, although I see some differences. Can you try the development branch via manual install and send me a debug log? |
Thank you for the quick response! I manually installed the development branch and the battery was detected and all everything appeared to be working as expected. However, HA has since lost the BLE connection to the battery and I've been unable to re-establish it by restarting HA. The integration reports " Failed setup, will retry: Could not find BMS (FC:45:C3:BC:D6:A8) via Bluetooth. " As for debug logs, I'm able to enable debug logging in the integration but I do not have any option to actually download the logs. When installed through HACS I do have the option to download the logs. Not sure what's happening there, probably user error but I'm not too sure. |
Could it be that Bluetooth is turned off by the battery, when there is no current? For the logs, if you are at integration, you can turn debug logs off and it will prompt you with a download then. |
I'm still able to connect to the battery using the ios app so I don't think it's an issue of the BMS turning off or anything. So I did a little more digging and found something interesting. While initially setting up the integration, bluetoothctl produced the following output:
However, now the output is quite different:
What finally worked was removing the integration, restarting HA, and then re-installing the integration. The output from bluetoothctl has returned to the expected. With things functioning again, I enabled logging, left things to setting for a few minutes, then moved the battery out of BLE signal range, waiting a few minutes, and then brought the battery back in range. Log here. |
EDIT: ok, I found the correct entries. Still the log shows a huge number of transmission errors that alter the data. I do not know how this can happen via BT but it is just messed up. I will do some fixes to make it more reliable, but in general the connection is bad. |
With the updated error checking, I'm no longer getting any data from the battery at all. Log here I'm not sure why there would be so many BT errors. The RSSI is -64, nice and strong. Edit: Parsing through the debug logs it appears that I'm receiving a valid data frame every 30.000 seconds and non-decodable data in between: 2025-02-24 21:44:42.984 DEBUG (MainThread) [custom_components.bms_ble] ZM20210512010036�: BMS data sample {'voltage': 13.295, 'current': 0.0, 'battery_level': 97, 'cycle_charge': 9.0, 'cycles': 1, 'temperature': 24.3, 'problem_code': 0, 'cell#0': 3.32, 'cell#1': 3.324, 'cell#2': 3.322, 'cell#3': 3.329, 'delta_voltage': 0.009, 'cycle_capacity': 119.655, 'power': 0.0, 'battery_charging': False, 'problem': False} 2025-02-24 21:45:12.983 DEBUG (MainThread) [custom_components.bms_ble] ZM20210512010036�: BMS data sample {'voltage': 13.286, 'current': 0.0, 'battery_level': 97, 'cycle_charge': 9.0, 'cycles': 1, 'temperature': 24.3, 'problem_code': 0, 'cell#0': 3.317, 'cell#1': 3.322, 'cell#2': 3.32, 'cell#3': 3.327, 'delta_voltage': 0.01, 'cycle_capacity': 119.574, 'power': 0.0, 'battery_charging': False, 'problem': False} 2025-02-24 21:45:42.983 DEBUG (MainThread) [custom_components.bms_ble] ZM20210512010036�: BMS data sample {'voltage': 13.286, 'current': 0.0, 'battery_level': 97, 'cycle_charge': 9.0, 'cycles': 1, 'temperature': 24.3, 'problem_code': 0, 'cell#0': 3.316, 'cell#1': 3.322, 'cell#2': 3.32, 'cell#3': 3.328, 'delta_voltage': 0.012, 'cycle_capacity': 119.574, 'power': 0.0, 'battery_charging': False, 'problem': False} 2025-02-24 21:46:12.983 DEBUG (MainThread) [custom_components.bms_ble] ZM20210512010036�: BMS data sample {'voltage': 13.275, 'current': 0.0, 'battery_level': 97, 'cycle_charge': 9.0, 'cycles': 1, 'temperature': 24.3, 'problem_code': 0, 'cell#0': 3.315, 'cell#1': 3.319, 'cell#2': 3.317, 'cell#3': 3.324, 'delta_voltage': 0.009, 'cycle_capacity': 119.475, 'power': 0.0, 'battery_charging': False, 'problem': False} 2025-02-24 21:46:42.983 DEBUG (MainThread) [custom_components.bms_ble] ZM20210512010036�: BMS data sample {'voltage': 13.276, 'current': 0.0, 'battery_level': 97, 'cycle_charge': 9.0, 'cycles': 1, 'temperature': 24.3, 'problem_code': 0, 'cell#0': 3.315, 'cell#1': 3.32, 'cell#2': 3.317, 'cell#3': 3.324, 'delta_voltage': 0.009, 'cycle_capacity': 119.484, 'power': 0.0, 'battery_charging': False, 'problem': False} 2025-02-24 21:47:12.983 DEBUG (MainThread) [custom_components.bms_ble] ZM20210512010036�: BMS data sample {'voltage': 13.285, 'current': 0.0, 'battery_level': 97, 'cycle_charge': 9.0, 'cycles': 1, 'temperature': 24.3, 'problem_code': 0, 'cell#0': 3.317, 'cell#1': 3.321, 'cell#2': 3.32, 'cell#3': 3.327, 'delta_voltage': 0.01, 'cycle_capacity': 119.565, 'power': 0.0, 'battery_charging': False, 'problem': False} |
Ok, I checked the log again, the parsing is correct. A lot of the received data is garbage, too short, or has incorrect checksum. By chance, are you using the Raspberry Pi internal BT? I do not see anything I could fix more from coding point of view. So I'll merge that code soon. Let me know if you need more help or if it is ok like this. |
Yes I'm using the built-in BT hardware on the RPi4b and I'm using the USB3 ports so that may explain some of the checksum issues. I left the battery overnight and I'm getting valid data every 30 seconds. That's fine for my needs. However there does seem to be an issue with the connection recovering after an interruption. I intentionally moved the battery out of BT range and then brought it back within range, expecting the connection to automatically re-establish and data to resume, but that's not the behavior I'm seeing. After bringing the battery back within BT range, the debug logs show packets being received but all data is invalid. Log here The only way I can coax things to work again is by rebooting the RPi. |
Ok, I see a chance to fix that in the protocol parsing (thanks for testing), but the basic issue with the RPi messing up data will persist. For that I strongly recommend to take a look at proper adapters, e.g. I took this LogiLink for no money (no I do not get any commission 😉) |
@Fandu21 I pushed a small fix that should bring the battery back in cases like you tested yesterday. Btw. I assume that you just kept the battery to short out of range before the connection was considered to be lost, otherwise it would have resynced. Anyway thanks for pointing it out, now it should even cover that case. 😃 |
Tested and the connection now re-establishes itself automatically. Awesome! |
Checklist
Please describe the enhancement you would like to have.
Thank you for this amazing add-on!! I am currently running version 1.12.0 and my TopBand BMS does not appear to currently be supported and I'm hoping that it can be added.
Additional context
Link to TBEnergy IOS App
The text was updated successfully, but these errors were encountered: