Skip to content
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

Add TDT BSM support #102

Closed
4 tasks done
goblinmaks opened this issue Nov 29, 2024 · 29 comments · Fixed by #117
Closed
4 tasks done

Add TDT BSM support #102

goblinmaks opened this issue Nov 29, 2024 · 29 comments · Fixed by #117
Assignees
Labels
enhancement New feature or request

Comments

@goblinmaks
Copy link

Checklist

  • I have filled out the template to the best of my ability.
  • I have understood that this integration is only about battery management systems with Bluetooth Low Energy support.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate of any previous feature requests.

Please describe the enhancement you would like to have.

https://www.tdtbms.com/products-category/smart-bms.html

Additional context

https://www.tdtbms.com/products-category/smart-bms.html
https://www.tdtbms.com/download.html

AndroidApp https://www.tdtbms.com/download-category/bluetooth-app.html

@goblinmaks goblinmaks added the enhancement New feature or request label Nov 29, 2024
@patman15
Copy link
Owner

It looks as if the TDT BMS uses a similar protocol to the Seplos v2.0. Thus, I will first try to finish #101 and then come back to your request. Maybe it's solved with one implementation.
Meanwhile, please provide the output of bluetoothctl info <MAC> and the service explorer script.

@patman15 patman15 self-assigned this Nov 30, 2024
@goblinmaks
Copy link
Author

goblinmaks commented Nov 30, 2024

Yep, looks it very similar if compare it by rs-485 part. I hope it will be similar for bluetooth proto.

@goblinmaks
Copy link
Author

goblinmaks commented Nov 30, 2024

image
image

@patman15
Copy link
Owner

Hi @goblinmaks, just checking, still interested? I would have soon time to try an implementation ...

@goblinmaks
Copy link
Author

goblinmaks commented Dec 10, 2024

Still interested, I will support with all that I can.

@patman15
Copy link
Owner

patman15 commented Dec 11, 2024

Hey! I started to look at what the BT app does, but for me it looks not really similar to a Seplos v2 BMS, but maybe I'm to tired. Are you able to capture the Bluetooth traffic when using the app with the battery? That would be the simplest way for me to get it running.

@goblinmaks
Copy link
Author

goblinmaks commented Dec 12, 2024

Captured
btsnoop_hci.log

@patman15
Copy link
Owner

Excellent, thanks. Confirms my thoughts, but now I have some real data I can implement against, great!

@patman15
Copy link
Owner

@goblinmaks first version available on the branch. If you can provide me a debug log and check values against the app, it would be great.

@goblinmaks
Copy link
Author

goblinmaks commented Dec 13, 2024

Super, I will do it tomorrow. Also I missed to add screenshot from app when capture bluetooth traffic. Screenshot_20241212_193215_BMS Meta.jpg

@goblinmaks
Copy link
Author

image
Could you please share more info how to debug it ?

@patman15
Copy link
Owner

Please have a look at the troubleshooting section of the README. I can help more later today. Most interesting is the output of bluetoothctl info <MAC>

@goblinmaks
Copy link
Author

image

@goblinmaks
Copy link
Author

goblinmaks commented Dec 14, 2024

ok, i have changed local name pattern to part of mac like "C0-D6*" and remove matching by service uuid. Have some connecting progress
image

@patman15
Copy link
Owner

Ok, for some reason the device changes it's name. Which is strange. Can you provide me the raw advertisement info using nRF connect and try the updated version I just pushed?

@goblinmaks
Copy link
Author

goblinmaks commented Dec 14, 2024

Looks like after first connect device changed name to XDZN*, is very similar to janvda/balena-pulseaudio#10

image
image
image
image
image

Automatically detects with latest changes, but not received any values.

@patman15
Copy link
Owner

patman15 commented Dec 14, 2024

Did you check if you need to pair the device, i.e. bluetoothctl pair <MAC>? Note that this does not work with a proxy!

UPDATE: I did a fake battery here that works with the app. This "battery" also works with the integration. So in principle it should work. Did you leave it running for at least 5-10 minutes? Probably the connection takes a while to get stable.

@patman15
Copy link
Owner

@goblinmaks I checked your recording and saw that there is an enable code. I added it, can you try again?

@goblinmaks
Copy link
Author

ok, will try it now.

@goblinmaks
Copy link
Author

@patman15 Excellent!
Works correctly using bluetooth_proxy and correctly get initial data.
Let me leave it for few hours to check long data collection.

image
image

@goblinmaks
Copy link
Author

goblinmaks commented Dec 15, 2024

Ok, have some error when re-add integration

image

@andreitoma-github
Copy link

Hi @patman15 !
Few weeks ago I used a Win10 machine and made a Wireshark capture between the Meta BMS (running on iPhone) and the a WattCycle battery (12V, 100Ah with BT).
The BMS advertise the name XDZN_001_AC50 and I suspect that is a TDT BMS for 4 cells only.
I hope this capture will be useful for you to validate the new TDT BSM support feature.
Capture1_connect_get_data_few_seconds_disconnect.zip

@goblinmaks
Copy link
Author

@andreitoma-github right not this integration works but have some problem with initial connection. I suspect that it can be a problem with my local setup only. Could you please try to install integration from the branch and check with your battery ?

@patman15
Copy link
Owner

Ok, have some error when re-add integration

Looks like your device was not correctly discovered, i.e. it has not announced the name via Bluetooth. That raises the error.

@patman15
Copy link
Owner

Hi @patman15 ! Few weeks ago I used a Win10 machine and made a Wireshark capture between the Meta BMS (running on iPhone) and the a WattCycle battery (12V, 100Ah with BT). The BMS advertise the name XDZN_001_AC50 and I suspect that is a TDT BMS for 4 cells only. I hope this capture will be useful for you to validate the new TDT BSM support feature.

Hi @andreitoma-github! Thanks for the input. The issue is that the current implementation can only handle 16 cell batteries since I did not exactly know how the responses would look like for a different cell count. Thanks to you I now know, I can fix that quite easily.

@patman15
Copy link
Owner

@andreitoma-github fixed 4S version, @goblinmaks there was something wrong with yesterdays version. Tests did not pass, probably try again with current one.

@goblinmaks
Copy link
Author

goblinmaks commented Dec 16, 2024

@patman15 re-adding works good with adapter. Some problem with one of my instance of bluetooth_proxy

@andreitoma-github
Copy link

andreitoma-github commented Dec 17, 2024

Hi @patman15
The commit 0d29712 on '102-add-tdt-bsm-support' branch works for me.
All sensors look correct.
The cell voltages and cell temperatures are correct.
The BT connection gets disrupted when the phone app is open and fetches data, but the integration reconnects after phone app is closed.
BT proxy is 5cm away of battery.
Thank you!
XDZN_001_AC50_HomeAssistant_BMS_16Dec2024
XDZN_001_AC50_Meta_BMS_16Dec2024

@patman15 patman15 linked a pull request Dec 17, 2024 that will close this issue
@patman15
Copy link
Owner

@andreitoma-github thanks for the feedback, will soon merge the code and include it with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants