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 bluetooth support #52

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add bluetooth support #52

wants to merge 4 commits into from

Conversation

syssi
Copy link
Owner

@syssi syssi commented Apr 17, 2023

TODOs:

  • Assemble request frame
  • Request status data
  • Assemble and validate response frames
  • Decode status data
  • Merge sensors from the UART version

Fixes: #65

@idanny50
Copy link

Hi! if you need some help I have 3 packs seplos boxes with bluetooth and I can make tests. I saw that on display board with bluetooth there is also space for an esp12f board. If you want to test this I can add a board there, I can also give you access to my systems if you want to test directly yourself. Have a good day!
seplos

@syssi
Copy link
Owner Author

syssi commented Jun 27, 2023

1. Write requests (0x12) to subscribe notification streams 
   Handle 0x0012 (Service UUID 0xff00, Char 0xff01, UUID 0x2902)
   -> 0x0001 (Notification: True)
   
2. Write requests (0x12) to the command characteristic
   Handle 0x0014 (Service UUID 0xff00, Char 0xff02)
   Payload: 7e1000465100003a7f0d

Receive notifications on handle 0x0011 (Service UUID 0xff00, Char 0xff01):

3. Notification: 7e14005100002443414e3a56696374726f6e202020202020202020313130312d535037
4. Notification: 3620100403014601f4260d

5. Write request (handle 0x0014)
   Payload: 7e100046620000a68a0d

6. Notification: 7e1400620000300000100d520d3e060bc30ba40bc40b9f02
7. Notification: 291542159307179803921798000603e815460300020308000000000000
8. Notification: 000032430d

9. Write request (handle 0x0014)
   Payload: 7e100046620000a68a0d

10. Notification: 7e1400620000300000100d530d3e060bc30ba40bc40b9f022315421594071798039217
11. Notification: 98000603e8154903000203080000000000000000b94f0d

12. Write request (handle 0x0014)
   Payload: 7e100046620000a68a0d
   
13. 7e1400620000300000100d540d3e060bc30ba40bc40b9f023a15431594071798039217980006
14. 03e815480300020308000000000000000029100d

@syssi
Copy link
Owner Author

syssi commented Jun 27, 2023

notifications.txt
Commands extracted from docs/pdus/btsnoop_hci_1101-10E-SP76-16S.log:

7e:10:00:46:47:00:01:00:e7:16:0d    # System parameters request
7e:10:00:46:51:00:00:3a:7f:0d       # Manufacturer info request
7e:10:00:46:61:00:01:00:f7:c1:0d    # 
7e:10:00:46:62:00:00:a6:8a:0d       # 

Different notification frames / responses:

# 0x47 System parameters response
7e:14:00:47:00:00:a9:00:3c:0e:38:0d:ac:0a:28:0a:8c:0e:42:0e:06:09:c4:0a:5a:0d:48:05:dc:16:44:75:4e:1a:e2:68:11:30:16:d0:15:7c:0f:aa:10:04:17:70:17:0c:0c:9f:0c:81:0a:bf:0a:dd:0c:d1:0c:9f:0a:47:0a:ab:0c:b3:0c:81:0a:47:0a:11:51:00:00:00:00:a3:1c:60:d8:00:00:6a:00:00:10:0d:50:0d:4d:0d:51:0d:52:0d:55:0d:51:0d:50:0d:54:0d:55:0d:52:0d:52:0d:51:0d:51:0d:51:0d:51:0d:4d:06:0b:bf:0b:ba:0b:bb:0b:c3:0b:c4:0b:9f:0a:92:15:4f:70:0f:06:75:f8:03:b5:75:f8:00:06:03:e8:15:51:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:02:03:08:00:00:00:00:00:00:00:00:00:00:00:00:ae:94:0d
7e:14:00:47:00:00:a9:00:3c:0e:38:0d:ac:0a:28:0a:8c:0e:42:0e:06:09:c4:0a:5a:0d:48:05:dc:16:44:15:4a:10:68:11:30:16:d0:15:7c:0f:aa:10:04:17:70:17:0c:0c:9f:0c:81:0a:bf:0a:dd:0c:d1:0c:9f:0a:47:0a:ab:0c:b3:0c:81:0a:47:0a:c9:0c:d1:0c:9f:0a:15:0a:ab:0a:ab:0b:0f:0c:9f:0c:81:0a:ab:0a:c9:0d:03:0c:d1:0a:47:0a:ab:0e:2f:0d:fd:0e:93:0d:fd:4e:20:4c:2c:af:ec:b0:b4:52:08:ad:f8:8a:d0:07:d0:75:f8:27:10:1b:32:1e:0b:0a:0a:10:0a:0a:1e:3c:05:05:01:0a:0a:1e:f0:30:02:01:60:50:64:09:00:0d:00:08:ff:ff:ff:3f:bf:9f:af:1e:31:31:30:31:2d:53:50:37:36:20:5d:2e:0d

# 0x51 Manufacturer info response
7e:14:00:51:00:00:24:43:41:4e:3a:56:69:63:74:72:6f:6e:20:20:20:20:20:20:20:20:20:31:31:30:31:2d:53:50:37:36:20:10:04:03:01:46:01:f4:26:0d

# 0x61
7e:14:00:61:00:00:6a:00:00:10:0d:4f:0d:4d:0d:50:0d:52:0d:55:0d:51:0d:50:0d:54:0d:53:0d:51:0d:51:0d:51:0d:50:0d:51:0d:51:0d:4d:06:0b:bf:0b:ba:0b:bb:0b:c3:0b:c4:0b:9f:0a:c4:15:4e:6f:fb:06:75:f8:03:b5:75:f8:00:06:03:e8:15:51:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:02:03:08:00:00:00:00:00:00:00:00:00:00:00:00:5e:ea:0d
7e:14:00:61:00:00:6a:00:00:10:0d:4f:0d:4d:0d:50:0d:52:0d:55:0d:50:0d:50:0d:53:0d:53:0d:51:0d:51:0d:51:0d:50:0d:51:0d:51:0d:4c:06:0b:bf:0b:ba:0b:bb:0b:c3:0b:c4:0b:9f:0a:b7:15:4e:6f:fb:06:75:f8:03:b5:75:f8:00:06:03:e8:15:51:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:02:03:08:0c:30:c0:00:00:00:00:00:00:00:00:00:00:50:0f:0d
7e:14:00:61:00:00:6a:00:00:10:0d:4f:0d:4d:0d:50:0d:52:0d:55:0d:50:0d:50:0d:53:0d:53:0d:51:0d:51:0d:51:0d:50:0d:51:0d:51:0d:4c:06:0b:bf:0b:ba:0b:bb:0b:c3:0b:c4:0b:9f:0a:b7:15:4e:6f:fb:06:75:f8:03:b5:75:f8:00:06:03:e8:15:51:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:02:03:08:00:00:00:00:00:00:00:00:00:00:00:00:50:0f:0d

# 0x62
7e:14:00:62:00:00:30:00:00:10:0d:54:0d:3e:06:0b:c3:0b:a4:0b:c4:0b:9f:02:3a:15:43:15:94:07:17:98:03:92:17:98:00:06:03:e8:15:48:03:00:02:03:08:00:00:00:00:00:00:00:00:29:10:0d
7e:14:00:62:00:00:30:00:00:10:0d:54:0d:3e:06:0b:c3:0b:a4:0b:c4:0b:9f:02:24:15:44:15:95:07:17:98:03:92:17:98:00:06:03:e8:15:49:03:00:02:03:08:00:00:00:00:00:00:00:00:f3:26:0d
7e:14:00:62:00:00:30:00:00:10:0d:55:0d:3e:06:0b:c3:0b:a4:0b:c4:0b:9f:02:3c:15:43:15:95:07:17:98:03:92:17:98:00:06:03:e8:15:47:03:00:02:03:08:00:00:00:00:00:00:00:00:f4:62:0d

@syssi syssi force-pushed the add-bluetooth-support branch from 8c223bd to b9d5b76 Compare June 27, 2023 06:31
@syssi syssi force-pushed the add-bluetooth-support branch from d8bcdb7 to e65ef7a Compare July 6, 2023 06:03
@manznOnly
Copy link

Hy Syssi,

have been trying to get the bluetooth to work for the last few days, but unfortunately can't get anything out ...

any idea what I can do to make it pull the data?
Here is the debug log from the current attempt:

[14:08:23][D][esp-idf:000]: W (16767) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x8
[14:08:23][D][esp-idf:000]: W (16777) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x8
[14:08:23][D][esp32_ble_tracker:245]: Starting scan...
[14:08:23][D][esp32_ble_client:048]: [0] [60:6E:41:08:70:3B] Found device
[14:08:23][D][esp32_ble_tracker:213]: Pausing scan to make connection...
[14:08:23][I][esp32_ble_client:064]: [0] [60:6E:41:08:70:3B] 0x00 Attempting BLE connection
[14:08:25][I][esp32_ble_client:196]: [0] [60:6E:41:08:70:3B] Connected
[14:08:25][D][esp32_ble_tracker:245]: Starting scan...
[14:08:25][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.81.AA
[14:08:53][W][seplos_bms_ble:202]: Command queue (6 of 6) was not completely processed. Please increase the update_interval if you see this warning frequently
[14:08:53][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA
[14:09:53][W][seplos_bms_ble:202]: Command queue (2 of 6) was not completely processed. Please increase the update_interval if you see this warning frequently
[14:09:53][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA
[14:10:53][W][seplos_bms_ble:202]: Command queue (2 of 6) was not completely processed. Please increase the update_interval if you see this warning frequently
[14:10:53][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA

@syssi
Copy link
Owner Author

syssi commented Jul 24, 2023

@manznOnly thanks for poking around. This feature isn't ready yet but your logs look promising already. Just the requests aren't implemented yet so we are sending garbage at the moment:

[14:09:53][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA

@manznOnly
Copy link

@manznOnly thanks for poking around. This feature isn't ready yet but your logs look promising already. Just the requests aren't implemented yet so we are sending garbage at the moment:

[14:09:53][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA

I understand, if you need someone to test - let me know - i have 6 Packs for testing :D

@FritsOV
Copy link

FritsOV commented May 9, 2024

@syssi Here are the bluetooth specs for 10E. You could put them into the doc section.

Seplos.bluetooth.protocol.2.pdf

@syssi syssi force-pushed the add-bluetooth-support branch from 82d677d to 2613155 Compare May 9, 2024 12:26
@syssi
Copy link
Owner Author

syssi commented May 9, 2024

@FritsOV Added. Thanks for your support!

@andreas-bulling
Copy link

any update on this if I may ask? Does BT work with the Seplos BMS and ESPHome?

@HA1Andrzej
Copy link

Hi @syssi , I will ask :) . At what stage is the work with BLE? I have always used RS485 connection, however, a bank of 3 storages was created and BLE would already be useful to monitor all of them :(

@syssi
Copy link
Owner Author

syssi commented Jul 22, 2024

The implementation has pretty low priority because the demand is very small. Do you have a working setup already and would you offer some testing?

@HA1Andrzej
Copy link

The implementation has pretty low priority because the demand is very small. Do you have a working setup already and would you offer some testing?

Thanks for the reply. Yes I have everything and can offer tests :). I even already installed the code esp32-ble-example.yaml.

@syssi syssi force-pushed the add-bluetooth-support branch from 2613155 to 19c8d17 Compare July 25, 2024 16:07
@andreas-bulling
Copy link

Hm, I tried the example code and this is what I see in the log:

[20:06:28][W][seplos_bms_ble:202]: Command queue (2 of 6) was not completely processed. Please increase the update_interval if you see this warning frequently
[20:06:28][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA
[20:06:28][D][esp32_ble_client:110]: [0] [60:6E:41:0F:3D:E6] ESP_GATTC_WRITE_CHAR_EVT

The update interval warning shows up frequently then. I have set it to 30s already...

@Honusi
Copy link

Honusi commented Oct 26, 2024

21:50:59][W][seplos_bms_ble:202]: Command queue (2 of 6) was not completely processed. Please increase the update_interval if you see this warning frequently
[21:50:59][D][seplos_bms_ble:586]: Send command (handle 0x14): 55.04.83.AA
[21:50:59][D][esp32_ble_client:110]: [0] [60:6E:41:B4:21:D2] ESP_GATTC_WRITE_CHAR_EVT

I have 2 banks. I am looking forward to being able to monitor the master

@andreas-bulling
Copy link

For those of you interested - there is now a Home Assistant integration that allows reading out individual packs and cell voltages over Bluetooth: https://github.com/patman15/BMS_BLE-HA

@syssi syssi force-pushed the add-bluetooth-support branch 2 times, most recently from 68ccac0 to 3977597 Compare December 30, 2024 10:20
@syssi syssi force-pushed the add-bluetooth-support branch from ddc75b9 to 7b1c3fa Compare December 30, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bluetooth support
7 participants