Closed xpinguinx closed 1 year ago
Could you add these lines to your configuration:
logger:
level: VERY_VERBOSE
logs:
basen_bms_ble: VERY_VERBOSE
ble_client: DEBUG
esp32_ble: DEBUG
esp32_ble_tracker: DEBUG
scheduler: DEBUG
component: DEBUG
sensor: DEBUG
api: DEBUG
api.service: DEBUG
Please flash the node with the updated configuration and provide a log capture. I would like to see the discovery of your BMS by the BLE tracker and the connection setup.
It looks like you haven't updated this line to the MAC address of your BMS:
https://github.com/syssi/esphome-basen-bms/blob/main/esp32-ble-example.yaml#L5
Please try to find out the MAC address of your device. You could use this scanner config for example:
https://github.com/syssi/esphome-basen-bms/blob/main/esp32-ble-scanner.yaml
This will print all available BLE devices to the log.
The mac-address error was an oversight when I copied the code you suggested I add for debugging :( The bluetooth mac-address of the bms is 90:A6:BF:93:A0:69
Thanks for your patience and support.
I attach the debug. debugOK.txt
This is the important part of the log:
[V][esp32_ble_client:189]: [0] [90:A6:BF:93:A0:69] ESP_GATTC_SEARCH_CMPL_EVT
[V][esp32_ble_client:192]: [0] [90:A6:BF:93:A0:69] Service UUID: 0x1800
[V][esp32_ble_client:194]: [0] [90:A6:BF:93:A0:69] start_handle: 0x1 end_handle: 0x7
[V][esp32_ble_client:192]: [0] [90:A6:BF:93:A0:69] Service UUID: 0x1801
[V][esp32_ble_client:194]: [0] [90:A6:BF:93:A0:69] start_handle: 0x8 end_handle: 0xf
[V][esp32_ble_client:192]: [0] [90:A6:BF:93:A0:69] Service UUID: 0xFF00
[V][esp32_ble_client:194]: [0] [90:A6:BF:93:A0:69] start_handle: 0x10 end_handle: 0x18
[I][esp32_ble_client:196]: [0] [90:A6:BF:93:A0:69] Connected
[E][basen_bms_ble:122]: [90:A6:BF:93:A0:69] No notify service found at device, not an BASEN BMS..?
It looks like your battery is equipped with a different BMS or the BLE communication has changed a bit. Could you tell me which Android app do you use to talk to your battery/BMS?
I use a Samsung S23 Ultra with Android 13 The vendor provided me with the APP which unfortunately is only in Chinese but works perfectly and communicates with the BMS I attach the application with the apk file BASENGREEN.zip
I attach the MQTT debugging video where you can see that at some point it disconnects
https://github.com/syssi/esphome-basen-bms/assets/19188638/d7a567d8-1679-4fec-bb83-05013a21d559
You are on the wrong track. ;-) The BLE client connection to the BMS can be established but the expected services/characteristics aren't available to no measurements can be retrieved and the connection gets disconnected again.
May be Basen has changed the BMS model or the bluetooth modul so this implementation and your BMS/battery aren't compatible at the moment. I will try to have a look what needs to be changed to support your BMS. This will take some time.
Are you able to create a btnsoop capture of the BLE traffic? Please follow this guide: https://medium.com/@charlie.d.anderson/how-to-get-the-bluetooth-host-controller-interface-logs-from-a-modern-android-phone-d23bde00b9fa
I would like to write directly to the manufacturer. Tell me what information and what I should ask to solve the problem and be able to use a bluetooth connection to receive data in the correct format. What services and features are not available?
I'll see if I can capture BLE traffic via btnsoop and update you. Thanks for now.
I want to contribute with a donation, can you tell me how?
I played around with the android app but it looks like the btsnoop capture is required to move on!
Dear Syssi, i ran the btsnoop capture with a Galaxy Note8 while logged into the BMS (TP_123456). Attached is the log file btsnoop_hci.log which can be analyzed with wireshark
Best regards
Good job! I will have a look later the day!
Write requests (0x12) to subscribe notification streams
1. Handle 0x0013 (Service UUID 0xff00, Char 0xff01, UUID 0x2902)
-> 0x0001 (Notification: True)
2. Handle 0x0018 (Service UUID 0xff00, Char 0xff03, UUID 0x2902)
-> 0x0001 (Notification: True)
# Write commands (0x52) on handle 0x0015 (Service UUID 0xff00, UUID 0xff02)
55:04:81:aa # Retrieve software version
55:04:82:aa # Retrieve hardware version
55:04:83:aa # Retrieve status 1 (SOC, total voltage, current, average temp, ambient temp, mosfet temp)
55:04:84:aa # Retrieve status 2 (Capacity, VoltageStatus, CurrentStatus, TemperatureStatus, AlarmStatus)
55:04:85:aa # Retrieve status 3 (MosfetStatus)
(55:04:86:aa # Gyro (unsupported here))
55:04:87:aa # Retrieve temperatures (temp1-4, max temp, min temp)
55:04:88:aa # Retrieve cell voltages 1-8
55:04:89:aa # Retrieve cell voltages 9-16
55:04:8a:aa # Retrieve cell voltages 17-24 (unsupported here)
55:04:90:aa # Retrieve location setting (string)
55:04:94:aa # Retrieve owner setting (string)
# Notifications on handle 0x0012 (Service UUID 0xff00, UUID 0xff01)
55:14:81:30:2e:31:2e:31:30:00:00:00:00:00:00:00:00:00:00:aa
55:14:82:54:50:2d:4c:54:35:35:00:54:42:00:00:00:00:00:00:aa
55:14:83:00:3c:14:72:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
55:14:83:00:3c:14:7d:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
55:14:83:00:3c:14:82:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
55:14:83:00:3c:14:86:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
55:14:83:00:3c:14:87:01:18:00:e6:00:fa:00:00:30:30:00:64:aa
55:14:83:00:3c:14:88:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
55:14:83:00:3c:14:89:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
55:14:83:00:3c:15:62:01:18:00:e6:00:fa:00:00:30:30:00:64:aa
55:14:83:00:3c:15:63:01:18:00:e6:00:fa:00:00:30:30:00:64:aa
55:14:84:10:04:59:d8:36:48:00:00:00:00:00:00:00:00:00:00:aa
55:14:85:08:23:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
55:14:87:00:e6:00:e6:00:e6:00:e6:00:00:00:00:00:00:00:00:aa
55:14:88:0c:c1:0c:d5:0c:d2:0c:d5:0c:c8:0c:d4:0c:c8:0c:d2:aa
55:14:88:0c:c1:0c:d5:0c:d4:0c:d6:0c:d2:0c:d8:0c:d5:0c:d6:aa
55:14:88:0c:c2:0c:ca:0c:d4:0c:d4:0c:d3:0c:d4:0c:d3:0c:d3:aa
55:14:88:0c:c2:0c:d7:0c:d5:0c:d7:0c:d3:0c:d8:0c:d6:0c:d8:aa
55:14:88:0c:c2:0c:dd:0c:d2:0c:d9:0c:d5:0c:dc:0c:da:0c:d5:aa
55:14:88:0c:c3:0c:cb:0c:c8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0d:56:0d:5c:0d:5b:0d:5f:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:59:0d:5c:0d:5e:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5a:0d:5a:0d:5e:0d:5c:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5a:0d:5f:0d:5c:0d:5c:0d:60:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5b:0d:5e:0d:5c:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5b:0d:5e:0d:5c:0d:5e:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5b:0d:5e:0d:5d:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5b:0d:5f:0d:5d:0d:5d:0d:60:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5b:0d:5f:0d:5d:0d:5e:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5c:0d:5f:0d:5c:0d:5e:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5c:0d:5f:0d:5d:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5c:0d:5f:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5a:0d:5c:0d:5f:0d:5d:0d:5e:0d:61:0d:60:aa
55:14:88:0d:57:0d:5a:0d:5d:0d:5f:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5a:0d:5f:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5c:0d:5c:0d:60:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5c:0d:5d:0d:62:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5c:0d:5e:0d:60:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5d:0d:5d:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5d:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5d:0d:5e:0d:60:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5e:0d:5d:0d:5e:0d:61:0d:60:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5f:0d:5c:0d:5d:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5b:0d:5f:0d:5d:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5b:0d:5c:0d:5f:0d:5c:0d:5d:0d:60:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5c:0d:5f:0d:5d:0d:5d:0d:61:0d:60:aa
55:14:88:0d:57:0d:5b:0d:5c:0d:5f:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5b:0d:5c:0d:5f:0d:5d:0d:5f:0d:61:0d:60:aa
55:14:88:0d:57:0d:5c:0d:5b:0d:5f:0d:5d:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:57:0d:5c:0d:5b:0d:5f:0d:5d:0d:5f:0d:62:0d:5e:aa
55:14:88:0d:58:0d:5a:0d:5b:0d:5f:0d:5c:0d:5e:0d:61:0d:5f:aa
55:14:88:0d:58:0d:5a:0d:5b:0d:5f:0d:5c:0d:5f:0d:61:0d:5f:aa
55:14:88:0d:58:0d:5a:0d:5b:0d:60:0d:5d:0d:5d:0d:60:0d:5f:aa
55:14:88:0d:58:0d:5a:0d:5c:0d:5f:0d:5c:0d:5e:0d:61:0d:61:aa
55:14:88:0d:58:0d:5b:0d:5a:0d:5f:0d:5c:0d:5e:0d:61:0d:60:aa
55:14:88:0d:58:0d:5b:0d:5b:0d:5e:0d:5c:0d:5d:0d:61:0d:60:aa
55:14:88:0d:58:0d:5b:0d:5b:0d:5e:0d:5d:0d:5d:0d:61:0d:60:aa
55:14:88:0d:58:0d:5b:0d:5b:0d:5e:0d:5d:0d:5f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5e:0d:5f:0d:5f:0d:5c:0d:5f:0d:65:aa
55:14:89:0d:5f:0d:60:0d:5c:0d:5e:0d:5e:0d:5e:0d:5e:0d:65:aa
55:14:89:0d:5f:0d:61:0d:5c:0d:5e:0d:5f:0d:5c:0d:5f:0d:64:aa
55:14:89:0d:5f:0d:61:0d:5d:0d:5e:0d:5e:0d:5c:0d:5f:0d:65:aa
55:14:8a:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
55:14:90:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
55:14:91:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
55:14:94:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
55:14:95:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
# Notifications on handle 0x0017 (Service UUID 0xff00, UUID 0xff03)
01:19
01:19
01:19
01:19
01:19
...
-> 55:04:81:aa
<- 55:14:81:30:2e:31:2e:31:30:00:00:00:00:00:00:00:00:00:00:aa
^^^^^^^^^^^^^^^^^^^data^^^^^^^^^^^^^^^^^^^^^^^^
= 0.1.10
0x55 SOF
0x14 Frame type (Response)
0x81 Address
0x30 0
0x2e .
0x31 1
0x2e .
0x31 1
0x30 0
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0xaa EOF
-> 55:04:82:aa
<- 55:14:82:54:50:2d:4c:54:35:35:00:54:42:00:00:00:00:00:00:aa
^^^^^^^^^^^^^^^^^^^data^^^^^^^^^^^^^^^^^^^^^^^^
= TP-LT55 TB
-> 55:04:83:aa
<- 55:14:83:00:3c:14:72:01:18:00:e6:00:f0:00:00:30:30:00:64:aa
0x55 SOF
0x14 Frame type (Response)
0x83 Address
0x00 0x3c State of charge 0x003c = 60%
0x14 0x72 Total voltage 0x1472 = 5234 * 0.01f = 52.34V
0x01 0x18 Temperature 0x0118 = 280 * 0.1f = 28.0°C
0x00 0xe6 Temperature 0x00e6 = 230 * 0.1f = 23.0°C
0x00 0xf0 Mosfet temp 0x00f0 = 240 * 0.1f = 24.0°C
0x00 0x00 Current (signed)
0x30 0x30 Unknown (signed)
0x00 0x64 State of health 0x0064 = 100%
0xaa EOF
-> 55:04:84:aa
<- 55:14:84:10:04:59:d8:36:48:00:00:00:00:00:00:00:00:00:00:aa
0x55 SOF
0x14 Frame type (Response)
0x84 Address
0x10 Cell count 0x10 = 16
0x04 Temp sensors 0x04 = 4
0x59 0xd8 Nominal capaciy 0x59d8 = 23000 * 0.01f = 230 Ah
0x36 0x48 Capacity remaining? 0x3648 = 13896 * 0.01f = 138.96 Ah
0x00 0x00 Cycle count 0x0000 = 0
0x00 0x00 Voltage State Bitmask
0x00 0x00 Current State Bitmask
0x00 0x00 Temperature Bitmask
0x00 0x00 Alarm Bitmask
0xaa EOF
-> 55:04:85:aa
<- 55:14:85:08:23:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
0x55 SOF
0x14 Frame type (Response)
0x85 Address
0x08 0x23 Mosfet State Bitmask (0b100000100011)
0x00 0x00 Unknown Bitmask
0x00 0x00 Unknown Bitmask
0x00 0x00 High Alarm Bitmask
0x00 0x00 Low Alarm Bitmask
0x00 0x00 Balancing? Bitmask
0x00 0x00 Unused
0x00 0x00 Unused
0xaa EOF
-> 55:04:87:aa
<- 55:14:87:00:e6:00:e6:00:e6:00:e6:00:00:00:00:00:00:00:00:aa
0x55 SOF
0x14 Frame type (Response)
0x87 Address
0x00 0xe6 Temperature 1 0x00e6 = 230 * 0.1f = 23°C
0x00 0xe6 Temperature 2 0x00e6 = 230 * 0.1f = 23°C
0x00 0xe6 Temperature 3 0x00e6 = 230 * 0.1f = 23°C
0x00 0xe6 Temperature 4 0x00e6 = 230 * 0.1f = 23°C
0x00 0x00 Temperature 5 (unsupported here)
0x00 0x00 Temperature 6 (unsupported here)
0x00 0x00 Temperature 7 (unsupported here)
0x00 0x00 Temperature 8 (unsupported here)
0xaa EOF
-> 55:04:88:aa
<- 55:14:88:0c:c1:0c:d5:0c:d2:0c:d5:0c:c8:0c:d4:0c:c8:0c:d2:aa
0x55 SOF
0x14 Frame type (Response)
0x88 Address
0x0c 0xc1 Cell voltage 1 0x0cc1 = 3265 * 0.001f = 3.265V
0x0c 0xd5 Cell voltage 2 0x0cd5 = 3285 * 0.001f = 3.285V
0x0c 0xd2 Cell voltage 3 0x0cd2 = 3282 * 0.001f = 3.282V
0x0c 0xd5 Cell voltage 4 ...
0x0c 0xc8 Cell voltage 5
0x0c 0xd4 Cell voltage 6
0x0c 0xc8 Cell voltage 7
0x0c 0xd2 Cell voltage 8
0xaa EOF
-> 55:04:89:aa
<- 55:14:89:0c:c8:0c:c8:0c:c7:0c:c7:0c:c1:0c:c3:0c:ca:0c:c8:aa
0x55 SOF
0x14 Frame type (Response)
0x89 Address
0x0c 0xc8 Cell voltage 9
0x0c 0xc8 Cell voltage 10
0x0c 0xc7 Cell voltage 11
0x0c 0xc7 Cell voltage 12
0x0c 0xc1 Cell voltage 13
0x0c 0xc3 Cell voltage 14
0x0c 0xca Cell voltage 15
0x0c 0xc8 Cell voltage 16
0xaa EOF
-> 55:04:90:aa
<- 55:14:90:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-> 55:04:91:aa (optional?)
<- 55:14:91:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
= 32 chars "location setting"
-> 55:04:94:aa
<- 55:14:94:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-> 55:04:95:aa (optional?)
<- 55:14:95:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:aa
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
= 32 chars "owner setting"
Dear Syssi, with these last comments of your hexadecimal code I got lost and confused :( Has the communication problem been resolved? Which yaml file should I use for programming? Thank you
I extracted these bytes from your btsnoop capture. Long story short: The BMS of your battery pack isn't a VIP-BMS/EE-BMS. The manufacturer of your BMS is called Tianpower and the BMS model is called TP-LT55. This device type isn't supported here and does speak a different language / uses a different protocol.
I tried to extract and decode/document the most important requests & responses from your btnsoop capture. This technical details can be used to implement the Tianpower protocol.
I ask if it is possible to implement this new protocol? If you prefer, we can talk privately on this email address bms@delink.it and reach an agreement. Thank you
Do you have time for heavily testing each step of the development?
I absolutely have to solve the bluetooth communication problem by exporting the data and sensors in the MQTT format. Can you please tell me what I should do and how long it takes for this job? Can we talk in private? Thank you
I've pushed a first draft of the tianpower protocol implementation. Please flash this YAML
https://github.com/syssi/esphome-tianpower-bms/blob/main/esp32-ble-example.yaml
and provide a ESPHome log. The log can be retrieve using the ESPhome CLI:
esphome logs esp32-ble-example.yaml
Could you check the Android app. Are there switches / button to control the mosfet state (charging on/off, discharging on/off)? Could you provide some screenshots of the different views of the Android app?
Could you check the Android app. Are there switches / button to control the mosfet state (charging on/off, discharging on/off)? Could you provide some screenshots of the different views of the Android app?
Image 1.zip Image 2.zip Image 3.zip Image 4.zip logs_tianpowerbms_compile.zip
I've pushed a fixed version of the YAML configuration.
The current implementation should be able to connect to the BMS and subscribe to some notification streams. The received raw data should be printed to the log. Please provide such a log. As soon as we are sure everything works as expected we can move on.
fails to finish compiling "esp32-ble-example.yaml" (error log file attached)
A clean build is required:
esphome clean esp32-ble-example.yaml
esphome run esp32-ble-example.yaml
If you use the ESPHome dashboard there should be a "clean build" button.
...with which procedure and how should I export the logs? debug MQTT I see this result
Do you use the ESPHome dashboard? If you click on a ESPHome node and choose the "log" button you should be able to copy&paste the log. A log capture of around 1-3 minutes would be nice.
Usi la dashboard di ESPHome? Se fai clic su un nodo ESPHome e scegli il pulsante "log", dovresti essere in grado di copiare e incollare il log. Un'acquisizione del registro di circa 1-3 minuti sarebbe utile.
Attached the log. Good work :)
I've pushed another change. In best case the component is able to decode and publish some measurements now via MQTT. Could you flash your device again and provide another log?
Unfortunately nothing has changed in MQTT :(
I attach the LOG file in which it seems to me that there is an error: logs_bms_compile.txt
I've fixed the mentioned issue. Please compile & flash the most recent version and provide another log. The log should provide the reason for not pushing measurements. These topics are implemented:
tianpower-bms-ble/sensor/tianpower-bms-ble_state_of_charge/state
tianpower-bms-ble/sensor/tianpower-bms-ble_total_voltage/state
log updated
I've pushed a fix. Please give it another try!
Good morning Syssi, Updated register, I remain available logs_bms_compile_4.txt
I also attach the MQTT status
The BMS wasn't available this time. May be because it supports just one simultaneous connection and the BLE module was too busy to pick up the new connection:
[W][tianpower_bms_ble:126]: [90:A6:BF:93:A0:69] Not connected
[W][tianpower_bms_ble:126]: [90:A6:BF:93:A0:69] Not connected
[W][tianpower_bms_ble:126]: [90:A6:BF:93:A0:69] Not connected
[W][tianpower_bms_ble:126]: [90:A6:BF:93:A0:69] Not connected
Could you provide another log?
WOW :)
Updated register: logs_bms_compile_5.txt
LOL. All measurements are a bit off. ;-) Will be fixed soon.
LOL. Tutte le misurazioni sono un po' fuori. ;-) Verrà risolto presto.
When you have finished the configuration, let me know your paypal address, thanks.
The decoding of the measurements is fine now. I would be happy if you could apply some load to your battery so you could check the current
sensor is working properly. If there is load this value should be positive. If you charge the battery the value should be negative. Please double check the resolution of the sensor. The factor is probably wrong at the moment.
Dear Syssi, finally the goal was a success thanks to your availability!
At the moment I don't have the possibility to check the "current" sensor because the photovoltaic system is in production with the old BMS. We remain that if I encounter problems I will update you in a few weeks.
Working with you has been pleasant and for this I congratulate you also for your professionalism and knowledge.
You are welcome! Thanks for your donation! Feel free to ping me if you miss something or some detail doesn't work as expected. Please try to improve your WiFi coverage. At the moment your ESP32 crashs every now probably because of a bad WiFi signal. On my test bench the setup is stable and doesn't reboot.
Is it possible to develop this same ESPHome component to monitor a 48Volt Basen BMS via the Bluetooth port and receive data in MQTT??
I tried to use "esp32-ble-example.yaml" and through the MQTT-EXPLORER debug application I see that the ESP32 connects to the BMS:
""[0;35m[C][mqtt.switch:041]: MQTT Switch 'basen-bms-ble enable bluetooth connection': [0m
but after a few seconds it disconnects displaying this other error: [0;33m[W][basen_bms_ble:213]: [A4:C1:38:27:48:9A] Not connected [0m
I note that the "switch" topics are displayed correctly in the MQTT brocker while the "sensors" of the cells, temperatures and everything else are not displayed.
I trust in your help, thank you