patman15 / BMS_BLE-HA

This integration allows to monitor Bluetooth Low Energy (BLE) battery management systems (BMS) from within Home Assistant.
GNU Lesser General Public License v2.1
6 stars 2 forks source link

Seplos BMS V3 #24

Open Goaheadz opened 2 weeks ago

Goaheadz commented 2 weeks ago

Checklist

Is your feature request related to a problem? Please describe.

Need help to start integration with Seplos BMS 3.0

Describe the solution you'd like

Guidance to implement this.

Additional context

I have Bluetooth proxy near BMS, but I dont see MAC adress. Should I see one? If it is not suposed to see results in scan/esp32 logs, then file known_devices.yaml should log the BMS mac? I can connect with no problems via Seplos Android app, but app does not show mac adress. image image

From the begining..what should I try first?

patman15 commented 2 weeks ago

Hey! Did you have a look at the contributing guidelines? In general I think, as long as no integration is registered for a device it is not stored in "known devices", not sure why the BTproxy does not find something, but might be a similar reason.

Goaheadz commented 2 weeks ago

image

Goaheadz commented 2 weeks ago

Finally was able to see BMS address and name in logs of the BLE proxy When I try to add the integration to HA I get the error:

image

So I guess I need some help now.

Goaheadz commented 2 weeks ago

New fork created. New py file create inside /plugins/seplosv3.py Copy content from base_bms to seplosv3.py File name added inside const.py

Goaheadz commented 2 weeks ago

image Need help for point 4, 6 and 7

Goaheadz commented 2 weeks ago

https://github.com/Goaheadz/BMS-Seplos-BLE-HA

patman15 commented 2 weeks ago

https://github.com/Goaheadz/BMS-Seplos-BLE-HA

I can have a look later. For point 4, well this is the core implementation on how to get the necessary data from the BMS and feed it into the dictionary. Some documentation of the protocol or other references are needed here.

Point 6, it would be good to have a scan, e.g. using nRF Connect (on Android) to see what is contained in the advertisement message of the BMS on BT. The stricter the filter the better for other users.

Point 7 we can tackle when the others are done.

Goaheadz commented 2 weeks ago

From the nRF app: Screenshot_2024-06-20-12-32-31-21_3c2e989be58abe9ca7463ffb1e6967d2

Goaheadz commented 2 weeks ago

Seplos.bluetooth.protocol.2.pdf

Maybe this one is valid for Seplos BMS V3 bluetooth protocol

patman15 commented 2 weeks ago

@Goaheadz according to this discussion v3 version is different. Unfortunately, I could not find the protocol description. If you can get it probably from customer support then I can have a deeper look on how to implement.

Goaheadz commented 2 weeks ago

BMS Modbus-RTU Protocol 蓝牙.docx

@patman15 Seplos support sent me this.

patman15 commented 2 weeks ago

I'll have a look if it is usable for Bluetooth communication as well. It says Modbus, so I'm not sure.

patman15 commented 1 week ago

From the nRF app

This scan makes me a bit suspicious because I can only see read-only characteristics. Are you able to query the BMS using an app on your phone via Bluetooth? Which app are you using? Trying to get a better picture in my head ...

Goaheadz commented 1 week ago

Only tried the official app from Seplos. From the app, we cannot change any settings beside inverter can protocol, its read data only. I did not run both apps in android at same time, so data from nRF is just scanning bluetooth without any reply from official app.

Hope this helps you.

patman15 commented 1 week ago

Hope this helps you.

Yes, thanks it gives another puzzle piece. Do you know how to generate a BT sniff while running the app? You can do this by going to Settings->Developer Options, then checking the box next to "Bluetooth HCI Snoop Log." In this thread there is also a hint on how to get the files from the mobile: https://stackoverflow.com/a/77997843 If you could enable this, run the app for a minute, stop it and get the btsnoop_hci.log it would help a lot. Meanwhile (or if you cannot do it), I'll prepare some scanning code for it in the integration as well to attack the issue from two sides.

Goaheadz commented 1 week ago

Cannot get the btsnoop_hci.log file. All steps I made seem ok, but I cannot find log file. (Have no root acess to phone) I tried to get it using adb commands,like:

"adb devices List of devices attached 799380ea device emulator-5562 offline"

Then: "adb pull /sdcard/btsnoop_hci.log"

But still receive message: "adb.exe: more than one device/emulator"

This is as far as my knowledge goes.

patman15 commented 1 week ago

Hi @Goaheadz!

Cannot get the btsnoop_hci.log file.

No worries. I have a test implementation you could try on the Seplos branch. You can install it manually. Also, could you please add to your `configuration.yaml the logging configuration:

logger:
  default: info
  logs:
    custom_components.bms_ble: debug

After the installation and the change in the configuration file, please restart Home Assistant! If you do not succeed, I could also generate a draft release to be installed via HACS, just let me know. Please send me the resulting home-assistant.log file after about 2-3 minutes.

Goaheadz commented 4 days ago

Hi @patman15

Sorry for late response. So many issues with ESPhome, and it took me a while to fix everything to a working state.

So followed all steps:

image

image

home-assistant.log

2024-07-04 18:26:03.344 DEBUG (MainThread) [custom_components.bms_ble] Bluetooth device detected: <BluetoothServiceInfoBleak name=SP05B2312190075 address=C0:D6:3C:4C:68:44 rssi=-71 manufacturer_data={} service_data={} service_uuids=['0000fff0-0000-1000-8000-00805f9b34fb'] source=D4:8A:FC:60:31:F4 connectable=True time=514124.17485928535 tx_power=-127>

Getting there

patman15 commented 3 days ago

2024-07-04 18:26:03.344 DEBUG (MainThread) [custom_components.bms_ble] Bluetooth device detected: <BluetoothServiceInfoBleak name=SP05B2312190075 address=C0:D6:3C:4C:68:44 rssi=-71 manufacturer_data={} service_data={} service_uuids=['0000fff0-0000-1000-8000-00805f9b34fb'] source=D4:8A:FC:60:31:F4 connectable=True time=514124.17485928535 tx_power=-127>

That looks good, but I miss further logs from my integration. Please change line 32 of seplos_bms.py in your installation UUID_SERVICE = normalize_uuid_str("1801") to UUID_SERVICE = normalize_uuid_str("fff0") restart and rerun and send me the log.

Thanks, Patrick

Goaheadz commented 3 days ago

After changing the line: image

image home-assistant.log

one step closer.

Goaheadz commented 3 days ago

Log 2024-07-04 23_02_01.txt I was able to use nrf logger to get more details.

no need for adb or root in phone

Hope this helps

Goaheadz commented 3 days ago

value: (0x) 01-04-34-0C-C8-0C-C8-0C-C8-0C-C7-0C-C6-0C-C7-0C-C7-0C-C6-0C-C7-0C-C7-0C-C7-0C-C7-0C-C7-0C-C7-0C-C7-0C-C8-0B-A5-0B-99-0B-9A-0B-A4-0A-AB-0A-AB-0A-AB-0A-AB-0B-C5-0B-B5-29-CA A 23:02:26.403 "(0x) 01-04-34-0C-C8-0C-C8-0C-C8-0C-C7-0C-C6-0C-C7-0C-C7-0C-C6-0C-C7-0C-C7-0C-C7-0C-C7-0C-C7-0C-C7-0C-C7-0C-C8-0B-A5-0B-99-0B-9A-0B-A4-0A-AB-0A-AB-0A-AB-0A-AB-0B-C5-0B-B5-29-CA" received

So we know that 0C-C8, 0C-C7, 0C-C6 etc in the line above is the cell voltages, since there are 16 cells and 16 hex code, that translate to decimal: 3272, 3271, 3270 in milivolts...so those are the cell voltages 3.27* volts

patman15 commented 3 days ago

Log 2024-07-04 23_02_01.txt I was able to use nrf logger to get more details. Hope this helps

That actually helps a lot. Let me investigate a bit. A few additional questions that help me find a working solution:

I'll do some updates and let you know.

Goaheadz commented 3 days ago

I think I changed something regarding nRF notifications, but not regarding BMS notifications, because everything is read-only in Seplos android app (except the CanBus protocol, that its allowed to be swapped).

I will try to change the BMS name, using windows app (DevBMSStudio) connected to rs485 (not sure if it can be done)

Thanks for the work so far.

Goaheadz commented 3 days ago

Seplos also sent me more information, (supposedly regarding Bluetooth) Information being developed by another great soul (Markus Muller). It seems that Seplos didn't finish the Bluetooth documentation yet and is building it, with community contributors.

image

This is what they sent me (credits to Markus Muller):

CRC16 generation over all bytes before the CRC bytes. Example C code:

static const uint8_t auchCRCHi[] = { 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 }; static const uint8_t auchCRCLo[] = { 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 }; // unsigned char puchMsg ; / message to calculate CRC upon / // unsigned short usDataLen ; / quantity of bytes in message / uint16_t CRC16(uint8_t puchMsg, uint16_t usDataLen) / The function returns the CRC as a unsigned short type / { uint8_t uchCRCHi = 0xFF; / high byte of CRC initialized / uint8_t uchCRCLo = 0xFF; / low byte of CRC initialized / uint32_t uIndex; / will index into CRC lookup table / while (usDataLen--) / pass through message buffer / { uIndex = uchCRCLo ^ puchMsg++; / calculate the CRC */ uchCRCLo = uchCRCHi ^ auchCRCHi[uIndex]; uchCRCHi = auchCRCLo[uIndex]; } return (uchCRCHi<< 8 | uchCRCLo); }

patman15 commented 3 days ago

Question about changing the name has the background on how to identify Seplos BMS via Bluetooth in a unique way. Their UUIDs are unfortunately not unique, they did not fill manufacturer data, thus name would be last resort. :disappointed: If name is changable, their again could be a conflict with other BMS types, making it impossible to assign the right protocol after detection. I updated the branch (just changed the UUIDs), if you run it you should see Rx BLE data: messages in the log with similar data as from the nRF logger. Can you get me such a log? Any ideas about the message format? E.g. how is the header defined ... ?

Goaheadz commented 3 days ago

I will make those changes as soon as I get home at the end of the day.

No idea about message format or header definition. I am trying with Seplos and looking at both documents provided.

In the mean time from the log above:

In this message from log file: E0-04-48-05-00-01-F4-4D-75-6C-74-69-50-6C-75-73-2D-49-49-20-34-38-2F-33-30-30-30-2F-33-35-00-00-00-00-00-00-00-00-00-56-69-63-74-72-6F-6E-20-43-61-6E-20-50-72-6F-74-6F-63-6F-6C-00-00-00-00-00-00-00-00-00-00-00-00-31-30-00-00-8A-4E" received

After breaking it from hex to text: 4D-75-6C-74-69-50-6C-75-73-2D-49-49-20-34-38-2F-33-30-30-30-2F-33-35 -> MultiPlus-II 48/3000/35 56-69-63-74-72-6F-6E-20-43-61-6E-20-50-72-6F-74-6F-63-6F-6C -> Victron Can Protocol

I will keep asking Seplos for more information.

Goaheadz commented 3 days ago

image

Those this info tells you something?

patman15 commented 3 days ago

Those this info tells you something?

Well I understood from the document that the BMS has register banks that you can readout. That would (normally) involved writing a command, e.g. which register/bank you want to know and then receiving the answer. Since the BMS seems to send data via BT without a specific request, I do know how to use this information. My assumption would be that some BT dataframes just contain a sequence of registers as listed. But it is hard to verify for me because I do not have a battery nor the app to run trial and error mode. If my changes cause the integration to receive data we can start trying to reverse engineer the content by comparing to the manual, the app, ...

Goaheadz commented 3 days ago

Question about changing the name has the background on how to identify Seplos BMS via Bluetooth in a unique way. Their UUIDs are unfortunately not unique, they did not fill manufacturer data, thus name would be last resort. 😞 ... ?

I remember I took some pictures of DevBMSStudio when I was playing with BMS: No manufacture, but there is a unique Device name (BMS16S200A-SP05B) image

patman15 commented 3 days ago

No manufacture, but there is a unique Device name (BMS16S200A-SP05B)

Ok, but this is not visible in the Bluetooth advertisement ...

patman15 commented 3 days ago

Ok, I figured it out, there are three types of messages, telling you the content of the block PIA, PIB, and PIC, which are described in the document.

E0-04-6A-0A-AB-0A-47-0C-9F-0C-D1-0C-D1-0D-03-0A-C9-0A-47-0A-AB-0A-15-0C-81-0C-9F-0C-D1-0D-03-0A-C9-
      ^^ length 106 == message length (111-3(HDR)-2(CRC))
   ^^ Read command response
^^ Bluetooth (PIA)

0A-AB-0A-AB-0A-47-0D-FD-0E-61-0D-FD-0E-F7-0B-0F-0A-AB-0C-9F-0A-AB-00-0A-0D-48-00-0F-00-05-03-C0-00-
96-00-64-00-46-00-32-6D-60-6D-60-34-64-00-30-00-3C-00-F0-00-0A-00-07-00-00-00-0D-00-00-01-F4-01-2C-
16-80-00-B4-FF-4C-00-05-00-08-ED-41
                              ^^ ^^ CRC

00-04-34-14-72-00-00-FF-C0-FF-FF-34-48-00-00-6D-60-00-00-00-D5-00-00-6D-60-00-00-00-01-00-00-00-00-
      ^^ length 52 == message length (57-3(HDR)-2(CRC))
   ^^ Read command response
^^ Bluetooth (PIB)

00-00-07-08-00-00-07-08-00-00-02-40-01-D0-00-01-00-09-01-DE-03-E7-57-A9
                                                                  ^^ ^^ CRC

01-04-22-14-72-FD-52-34-64-6D-60-00-D5-01-DF-03-E7-00-09-0C-C7-0B-9F-0C-C8-0C-C6-0B-A5-0B-99-00-00-
      ^^ length 34 == message length (39-3(HDR)-2(CRC))
   ^^ Read command response
^^ Bluetooth (PIC)

00-B4-00-B4-4E-04
             ^^ ^^ CRC

Based on that I can get a working version within a few days, protocol is a bit strange, so I'm not sure how reliable it will be, but let's take it a step further! @Goaheadz can you provide me a new nRF log and a corresponding screenshot from the app where I can see the actual values so that I'm sure I decoded right?

Goaheadz commented 3 days ago

Great!!

I updated the branch (just changed the UUIDs), if you run it you should see Rx BLE data: messages in the log with similar data as from the nRF logger. Can you get me such a log?

Do you want me to update UUIDs first and then provide log from nRF with screen shots of the seplos app? Or UUIDs change is not needed?

Let me get home and I will provide you with data.

patman15 commented 3 days ago

If you do the change first, it would help even more. I could then use the HA log, the nRF logger, and the screenshot to ensure it's equal. But it's not mandatory.

Let me get home and I will provide you with data.

Sure, when ever it suits you. :smile:

patman15 commented 2 days ago

Figured out something new: all messages come twice with different length. E.g. the one you found with the cell values (0x) 01-04-34-... but there is a similar header (0x) 01-04-22- which obviously contains other data. The third value is definitely the length. Very strange protocol.

Goaheadz commented 2 days ago

First I started nRF and connected to BMS, then I started the nRF logger and only then I started Seplos app: Some "Rx BLE data:" can be seen now in homeassistant log.

home-assistant.log

Screenshot_2024-07-06-11-20-40-93_00535804b94f6fc02d85630e000fee76 Screenshot_2024-07-06-11-20-50-52_00535804b94f6fc02d85630e000fee76 Screenshot_2024-07-06-11-21-04-08_00535804b94f6fc02d85630e000fee76 Screenshot_2024-07-06-11-21-17-65_00535804b94f6fc02d85630e000fee76

Goaheadz commented 2 days ago

The battery is being charge at same time I took the screenshots and log, so some data may differ. Bellow some quick decode from "RX data ble", to help you out.

Message: \x00\x04, \x0c\xfe 3326 - hiher cell voltage \x0c\xfb 3323 - lower cell voltage \x00\x03 3 millivolt diference \x00\x00 \x14\xc8 5320 - total voltage? 53.2V \x14\xc8 5320 - total voltage? 53.2V \x00\x00 \x00\x00 \x00\xea temp 1 234 - 23.4C \x00\xe3 temp 2 227 - 22.7C \x00\xe6 temp 3 230 - 23.0C where is temp 4?? \x00\x00 \x00\x01 \x01\xe1 - State of charge 481 - 48.1% \x01\xe1 - State of charge 481 - 48.1% \x00\t \x03\xe7 - 999 SOH \x00\xf5 - 245 \x00\xf5 - 245 \x00\xf5 - 245 \x00\x00 \x00\x00 \x9f\x93

New message:

\x00\x04 \x0c\xfd 3325 - higher cell voltage 3.325V \x0c\xfa 3322 - lowest cell voltage 3.322V \x00\x03 voltage diference 3 millivolt - 0.003V \x00\x00 \x14\xc6 total voltage: 53.18V \x14\xc6 \x00\x00\x00\x00 \x00\xea max temp: 23.4C \x00\xe3 min temp: 22.7C \x00\xe6 23.0??? \x00\x00\x00 \x01\x01 \xe2\x01 \xe2\x00\t \x03\xe7 \x00\xf5 245 \x00\xf5 245 \x00\xf5 245 \x00\x00\x00\x00 \xe3\x1e')

New message:

\x01\x044: ( 16 cell voltages) \x0c\xfc \x0c\xfc \x0c\xfc \x0c\xfd \x0c\xfe \x0c\xfd \x0c\xfd \x0c\xfd \x0c\xfe \x0c\xfc \x0c\xfd \x0c\xfd \x0c\xfd \x0c\xfc \x0c\xfd \x0c\xfc

remain part i dont know: \x0b\x95 2965 \x0b\x8e 2958 \x0b\x8f\ 2959 x0b\x94\n 2964 \xab\n\xab\n\xab\n \xab\x0b 43787 \xb2\x0b 45579 \xa0\xcc] 41164

Goaheadz commented 2 days ago

Log 2024-07-06 11_19_24.txt

nRF log

patman15 commented 1 day ago

Hi! Ok, that helped a lot. Still a strange protocol, but it seems possible to use. Can you please manually update the integration to the latest code from the seplos_v3 branch? Then, please let it run a few minutes and send me your observations and the home-assistant.log for me to check? In theory everything but the individual cell voltages should be visible already.

Goaheadz commented 1 day ago

Update done.

No "rx ble data" found in home assistant log file. :( Did you remove that debug state or problem with UUIDs definition?

2024-07-06 21:27:28.164 INFO (MainThread) [homeassistant.setup] Setting up bms_ble 2024-07-06 21:27:28.241 DEBUG (MainThread) [custom_components.bms_ble] Setup of 2024-07-06 21:27:28.241 DEBUG (MainThread) [custom_components.bms_ble] Initializing coordinator for SP05B2312190075 (C0:D6:3C:4C:68:44) as Seplos Smart BMS V3 2024-07-06 21:27:28.241 DEBUG (MainThread) [custom_components.bms_ble] device data: {'name': 'SP05B2312190075 ', 'address': 'C0:D6:3C:4C:68:44', 'rssi': -72, 'manufacturer_data': {}, 'service_data': {}, 'service_uuids': ['0000fff0-0000-1000-8000-00805f9b34fb'], 'source': 'D4:8A:FC:60:31:F4', 'advertisement': AdvertisementData(local_name='SP05B2312190075 ', service_uuids=['0000fff0-0000-1000-8000-00805f9b34fb'], tx_power=-127, rssi=-72), 'device': BLEDevice(C0:D6:3C:4C:68:44, SP05B2312190075 ), 'connectable': True, 'time': 697896.730600165, 'tx_power': None} 2024-07-06 21:27:28.242 DEBUG (MainThread) [custom_components.bms_ble] BMS SP05B2312190075 data update

2024-07-06 21:35:07.454 DEBUG (MainThread) [custom_components.bms_ble] Device communication timeout 2024-07-06 21:35:07.454 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching SP05B2312190075 data in 10.005 seconds (success: False)

image

Here is the log file: home-assistant.log

patman15 commented 1 day ago

No "rx ble data" found in home assistant log file. :( Did you remove that debug state or problem with UUIDs definition?

I did not remove the debug line, so strange. I reverted a change (that should have no impact in my opinion), can you try again? For some reason the notifications from the BMS are not received, but I cannot spot the issue. Will try tomorrow again, if my latest change did not help.

Goaheadz commented 1 day ago

Yesterday you had: def _notification_handler(self, sender, data: bytearray) -> None: """Retrieve BMS data update."""

    LOGGER.debug(
        "(%s) Rx BLE data: %s",
        self._ble_device.name,
        data,
    )

    self._data_event.set()

Today you updated to:

def _notification_handler(self, sender, data: bytearray) -> None: """Retrieve BMS data update."""

    if (
        len(data) > self.HEAD_LEN + self.CRC_LEN
        and data[1] == self.CMD_READ
        and data[0] in self.PART
        and data[2] >= self.HEAD_LEN + self.CRC_LEN
    ):
        self._data = data
        self._exp_len = (
            data[2] + self.HEAD_LEN + self.CRC_LEN
        )  # expected packet length
    elif len(data) and self._data is not None:
        self._data += data

    LOGGER.debug(
        "(%s) Rx BLE data (%s): %s",
        self._ble_device.name,
        "start" if data == self._data else "cnt.",
        data,
    )

Maybe this condition is failing: "start" if data == self._data else "cnt.",

or maybe you need at the end to confirm data was received: self._data_event.set()

just guessing as I am not a SW person.

Goaheadz commented 1 day ago

I deleted the pycache and reinstaled integration. Have more data in log file but still no RX data:

2024-07-06 23:37:31.256 DEBUG (MainThread) [custom_components.bms_ble] confirm step for SP05B2312190075
2024-07-06 23:37:31.258 INFO (MainThread) [homeassistant.setup] Setting up bms_ble 2024-07-06 23:37:31.266 DEBUG (MainThread) [custom_components.bms_ble] Setup of 2024-07-06 23:37:31.266 DEBUG (MainThread) [custom_components.bms_ble] Initializing coordinator for SP05B2312190075 (C0:D6:3C:4C:68:44) as Seplos Smart BMS V3 2024-07-06 23:37:31.266 DEBUG (MainThread) [custom_components.bms_ble] device data: {'name': 'SP05B2312190075 ', 'address': 'C0:D6:3C:4C:68:44', 'rssi': -72, 'manufacturer_data': {}, 'service_data': {}, 'service_uuids': ['0000fff0-0000-1000-8000-00805f9b34fb'], 'source': 'D4:8A:FC:60:31:F4', 'advertisement': AdvertisementData(local_name='SP05B2312190075 ', service_uuids=['0000fff0-0000-1000-8000-00805f9b34fb'], tx_power=-127, rssi=-72), 'device': BLEDevice(C0:D6:3C:4C:68:44, SP05B2312190075 ), 'connectable': True, 'time': 705698.297385054, 'tx_power': None} 2024-07-06 23:37:31.267 DEBUG (MainThread) [custom_components.bms_ble] BMS SP05B2312190075 data update 2024-07-06 23:37:31.267 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] Connecting BMS (SP05B2312190075 ) 2024-07-06 23:37:32.088 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 00001800-0000-1000-8000-00805f9b34fb, char 00002a00-0000-1000-8000-00805f9b34fb (#3): ['read', 'write'] 2024-07-06 23:37:32.088 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 00001800-0000-1000-8000-00805f9b34fb, char 00002a01-0000-1000-8000-00805f9b34fb (#5): ['read', 'write'] 2024-07-06 23:37:32.088 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 00001800-0000-1000-8000-00805f9b34fb, char 00002a04-0000-1000-8000-00805f9b34fb (#7): ['read'] 2024-07-06 23:37:32.088 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 00001800-0000-1000-8000-00805f9b34fb, char 00002ac9-0000-1000-8000-00805f9b34fb (#9): ['read'] 2024-07-06 23:37:32.088 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 00001801-0000-1000-8000-00805f9b34fb, char 00002a05-0000-1000-8000-00805f9b34fb (#12): ['read', 'indicate'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 0000fff0-0000-1000-8000-00805f9b34fb, char 0000fff1-0000-1000-8000-00805f9b34fb (#16): ['read', 'notify'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 0000fff0-0000-1000-8000-00805f9b34fb, char 0000fff2-0000-1000-8000-00805f9b34fb (#20): ['read', 'write-without-response', 'write'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 02f00000-0000-0000-0000-00000000fe00, char 02f00000-0000-0000-0000-00000000ff03 (#25): ['read'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 02f00000-0000-0000-0000-00000000fe00, char 02f00000-0000-0000-0000-00000000ff02 (#27): ['read', 'notify'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 02f00000-0000-0000-0000-00000000fe00, char 02f00000-0000-0000-0000-00000000ff00 (#30): ['read'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 02f00000-0000-0000-0000-00000000fe00, char 02f00000-0000-0000-0000-00000000ff01 (#32): ['write-without-response', 'write'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 02f00000-0000-0000-0000-00000000fe00, char 02f00000-0000-0000-0000-00000000ff04 (#34): ['read', 'write-without-response', 'write', 'notify'] 2024-07-06 23:37:32.089 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Discovered service 02f00000-0000-0000-0000-00000000fe00, char 02f00000-0000-0000-0000-00000000ff05 (#37): ['read', 'write-without-response', 'write'] 2024-07-06 23:37:32.090 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Using characteristics handle #16 (notify), #0 (write)

patman15 commented 1 day ago

Have more data in log file but still no RX data:

Hmm, in that case we are missing some command to enable the notifications from the BMS. I do not know why they were enabled before and now they are gone. The logs basically tell me that the integration is waiting for data which so far came. Did you change some DIP switches on the battery? I tried to get the BT app to check it's communication, but none of the links I could find works, as Seplos changed their domain. With the app I could build a fake battery to see what happens. What also would help, would be a bluetooth log when using the app as described in a very early post of mine.

Goaheadz commented 1 day ago

As soon as I connected the Seplos app, data start flowing: (14:20:34 till 14:20:41)

2024-07-07 14:20:21.322 DEBUG (MainThread) [custom_components.bms_ble] BMS SP05B2312190075 data update 2024-07-07 14:20:21.322 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] BMS SP05B2312190075 already connected 2024-07-07 14:20:22.395 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 5B:C8:57:B7:5E:C2 2024-07-07 14:20:31.323 DEBUG (MainThread) [custom_components.bms_ble] Device communication timeout 2024-07-07 14:20:31.323 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching SP05B2312190075 data in 10.002 seconds (success: False) 2024-07-07 14:20:34.397 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 5B:C8:57:B7:5E:C2 2024-07-07 14:20:36.850 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (start): bytearray(b'\x00\x044\x14\xd0\x00\x00\x00\x80\x00\x0094\x00\x00m\x00\x00\x00\xe5\x00\x00m\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07\x08\x00\x00\x07\x08\x00\x00\x02@\x01\xd0\x00\x01\x00\n\x02\x0b\x03\xe7s\xe9') 2024-07-07 14:20:36.850 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx data CRC is invalid: 59763 != 59763 or wrong message bytearray(b'\x00\x044') 2024-07-07 14:20:36.952 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (start): bytearray(b'\x00\x04,\r\x03\r\x00\x00\x03\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xea\x00\xea\x00\xea\x00\x00\x00\x00\xefE') 2024-07-07 14:20:37.065 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:') 2024-07-07 14:20:37.066 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x03\r\x00\x00\x03\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xea\x00\xea\x00\xea\x00\x00\x00\x00\xefE\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:'), 1: bytearray(b'')} 2024-07-07 14:20:37.170 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN') 2024-07-07 14:20:37.171 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x03\r\x00\x00\x03\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xea\x00\xea\x00\xea\x00\x00\x00\x00\xefE\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN'), 1: bytearray(b'')} 2024-07-07 14:20:37.269 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1') 2024-07-07 14:20:37.269 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x03\r\x00\x00\x03\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xea\x00\xea\x00\xea\x00\x00\x00\x00\xefE\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1'), 1: bytearray(b'')} 2024-07-07 14:20:37.391 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\xe0\x04j\x00\x04\x00\x10\x15h\x15\xe0\x15|\x16\x80\x12\xc0\x12 \x12\xc0\x10\xe0\rH\r\xac\rH\x0e\x10\x0c\x1c\x0bT\x0c\x1c\n\x8c\x07\xd0\x03\xe8\x01\xf4\x00\xcb\x00\xcd\x00\xd2\x00d\x01,\x01,\xff5\xff3\xff.\x00d\xfe\xa2\x01,\xfe\xd4\x00j\x02X\x00\x05\x0b\xb8\x00\xcd\x00\n\r\xac\rH\x05\xdc\x03\xe8\x03 \x00\xc8\x00\x1e\x0c\x81\x0c\x9f\x0c\x9f\x0c\xd1\n\xdd\n\xbf\xa5\xdd') 2024-07-07 14:20:37.391 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x03\r\x00\x00\x03\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xea\x00\xea\x00\xea\x00\x00\x00\x00\xefE\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1\xe0\x04j\x00\x04\x00\x10\x15h\x15\xe0\x15|\x16\x80\x12\xc0\x12 \x12\xc0\x10\xe0\rH\r\xac\rH\x0e\x10\x0c\x1c\x0bT\x0c\x1c\n\x8c\x07\xd0\x03\xe8\x01\xf4\x00\xcb\x00\xcd\x00\xd2\x00d\x01,\x01,\xff5\xff3\xff.\x00d\xfe\xa2\x01,\xfe\xd4\x00j\x02X\x00\x05\x0b\xb8\x00\xcd\x00\n\r\xac\rH\x05\xdc\x03\xe8\x03 \x00\xc8\x00\x1e\x0c\x81\x0c\x9f\x0c\x9f\x0c\xd1\n\xdd\n\xbf\xa5\xdd'), 1: bytearray(b'')} 2024-07-07 14:20:37.504 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\xe0\x04j\n\xab\nG\x0c\x9f\x0c\xd1\x0c\xd1\r\x03\n\xc9\nG\n\xab\n\x15\x0c\x81\x0c\x9f\x0c\xd1\r\x03\n\xc9\n\xab\n\xab\nG\r\xfd\x0ea\r\xfd\x0e\xf7\x0b\x0f\n\xab\x0c\x9f\n\xab\x00\n\rH\x00\x0f\x00\x05\x03\xc0\x00\x96\x00d\x00F\x002mm94\x000\x00<\x00\xf0\x00\n\x00\x07\x00\x00\x00\r\x00\x00\x01\xf4\x01,\x16\x80\x00\xb4\xffL\x00\x05\x00\x08\xea\x90') 2024-07-07 14:20:37.505 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x03\r\x00\x00\x03\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xea\x00\xea\x00\xea\x00\x00\x00\x00\xefE\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1\xe0\x04j\x00\x04\x00\x10\x15h\x15\xe0\x15|\x16\x80\x12\xc0\x12 \x12\xc0\x10\xe0\rH\r\xac\rH\x0e\x10\x0c\x1c\x0bT\x0c\x1c\n\x8c\x07\xd0\x03\xe8\x01\xf4\x00\xcb\x00\xcd\x00\xd2\x00d\x01,\x01,\xff5\xff3\xff.\x00d\xfe\xa2\x01,\xfe\xd4\x00j\x02X\x00\x05\x0b\xb8\x00\xcd\x00\n\r\xac\rH\x05\xdc\x03\xe8\x03 \x00\xc8\x00\x1e\x0c\x81\x0c\x9f\x0c\x9f\x0c\xd1\n\xdd\n\xbf\xa5\xdd\xe0\x04j\n\xab\nG\x0c\x9f\x0c\xd1\x0c\xd1\r\x03\n\xc9\nG\n\xab\n\x15\x0c\x81\x0c\x9f\x0c\xd1\r\x03\n\xc9\n\xab\n\xab\nG\r\xfd\x0ea\r\xfd\x0e\xf7\x0b\x0f\n\xab\x0c\x9f\n\xab\x00\n\rH\x00\x0f\x00\x05\x03\xc0\x00\x96\x00d\x00F\x002mm94\x000\x00<\x00\xf0\x00\n\x00\x07\x00\x00\x00\r\x00\x00\x01\xf4\x01,\x16\x80\x00\xb4\xffL\x00\x05\x00\x08\xea\x90'), 1: bytearray(b'')} 2024-07-07 14:20:44.537 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (start): bytearray(b'\x00\x044\x14\xd0\x00\x00\x00\x81\x00\x0094\x00\x00m\x00\x00\x00\xe5\x00\x00m\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07\x08\x00\x00\x07\x08\x00\x00\x02@\x01\xd0\x00\x01\x00\n\x02\x0b\x03\xe7\x1eE') 2024-07-07 14:20:44.537 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx data CRC is invalid: 17694 != 17694 or wrong message bytearray(b'\x00\x044') 2024-07-07 14:20:44.844 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (start): bytearray(b'\x00\x04,\r\x04\r\x01\x00\x04\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xeb\x00\xeb\x00\xeb\x00\x00\x00\x00\xb8i') 2024-07-07 14:20:45.160 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:') 2024-07-07 14:20:45.160 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x04\r\x01\x00\x04\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xeb\x00\xeb\x00\xeb\x00\x00\x00\x00\xb8i\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:'), 1: bytearray(b'')} 2024-07-07 14:20:45.760 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN') 2024-07-07 14:20:45.760 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x04\r\x01\x00\x04\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xeb\x00\xeb\x00\xeb\x00\x00\x00\x00\xb8i\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN'), 1: bytearray(b'')} 2024-07-07 14:20:46.112 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1') 2024-07-07 14:20:46.112 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x04\r\x01\x00\x04\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xeb\x00\xeb\x00\xeb\x00\x00\x00\x00\xb8i\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1'), 1: bytearray(b'')} 2024-07-07 14:20:46.408 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\xe0\x04j\x00\x04\x00\x10\x15h\x15\xe0\x15|\x16\x80\x12\xc0\x12 \x12\xc0\x10\xe0\rH\r\xac\rH\x0e\x10\x0c\x1c\x0bT\x0c\x1c\n\x8c\x07\xd0\x03\xe8\x01\xf4\x00\xcb\x00\xcd\x00\xd2\x00d\x01,\x01,\xff5\xff3\xff.\x00d\xfe\xa2\x01,\xfe\xd4\x00j\x02X\x00\x05\x0b\xb8\x00\xcd\x00\n\r\xac\rH\x05\xdc\x03\xe8\x03 \x00\xc8\x00\x1e\x0c\x81\x0c\x9f\x0c\x9f\x0c\xd1\n\xdd\n\xbf\xa5\xdd') 2024-07-07 14:20:46.408 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x04\r\x01\x00\x04\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xeb\x00\xeb\x00\xeb\x00\x00\x00\x00\xb8i\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1\xe0\x04j\x00\x04\x00\x10\x15h\x15\xe0\x15|\x16\x80\x12\xc0\x12 \x12\xc0\x10\xe0\rH\r\xac\rH\x0e\x10\x0c\x1c\x0bT\x0c\x1c\n\x8c\x07\xd0\x03\xe8\x01\xf4\x00\xcb\x00\xcd\x00\xd2\x00d\x01,\x01,\xff5\xff3\xff.\x00d\xfe\xa2\x01,\xfe\xd4\x00j\x02X\x00\x05\x0b\xb8\x00\xcd\x00\n\r\xac\rH\x05\xdc\x03\xe8\x03 \x00\xc8\x00\x1e\x0c\x81\x0c\x9f\x0c\x9f\x0c\xd1\n\xdd\n\xbf\xa5\xdd'), 1: bytearray(b'')} 2024-07-07 14:20:46.790 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\xe0\x04j\n\xab\nG\x0c\x9f\x0c\xd1\x0c\xd1\r\x03\n\xc9\nG\n\xab\n\x15\x0c\x81\x0c\x9f\x0c\xd1\r\x03\n\xc9\n\xab\n\xab\nG\r\xfd\x0ea\r\xfd\x0e\xf7\x0b\x0f\n\xab\x0c\x9f\n\xab\x00\n\rH\x00\x0f\x00\x05\x03\xc0\x00\x96\x00d\x00F\x002mm94\x000\x00<\x00\xf0\x00\n\x00\x07\x00\x00\x00\r\x00\x00\x01\xf4\x01,\x16\x80\x00\xb4\xffL\x00\x05\x00\x08\xea\x90') 2024-07-07 14:20:46.790 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Wrong data length (2!=49): {0: bytearray(b'\x00\x04,\r\x04\r\x01\x00\x04\x00\x00\x14\xd0\x14\xd0\x00\x00\x00\x00\x00\xe3\x00\xdd\x00\xe0\x00\x00\x00\x01\x02\x0b\x02\x0b\x00\n\x03\xe7\x00\xeb\x00\xeb\x00\xeb\x00\x00\x00\x00\xb8i\x00\x01\n\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x8e:\xe0\x04H\x05\x00\x01\xf4MultiPlus-II 48/3000/35\x00\x00\x00\x00\x00\x00\x00\x00\x00Victron Can Protocol\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0010\x00\x00\x8aN\x00\x01\n\xff\xff?\x01\x7f/\x9f\x0fcoT\xa1\xe0\x04j\x00\x04\x00\x10\x15h\x15\xe0\x15|\x16\x80\x12\xc0\x12 \x12\xc0\x10\xe0\rH\r\xac\rH\x0e\x10\x0c\x1c\x0bT\x0c\x1c\n\x8c\x07\xd0\x03\xe8\x01\xf4\x00\xcb\x00\xcd\x00\xd2\x00d\x01,\x01,\xff5\xff3\xff.\x00d\xfe\xa2\x01,\xfe\xd4\x00j\x02X\x00\x05\x0b\xb8\x00\xcd\x00\n\r\xac\rH\x05\xdc\x03\xe8\x03 \x00\xc8\x00\x1e\x0c\x81\x0c\x9f\x0c\x9f\x0c\xd1\n\xdd\n\xbf\xa5\xdd\xe0\x04j\n\xab\nG\x0c\x9f\x0c\xd1\x0c\xd1\r\x03\n\xc9\nG\n\xab\n\x15\x0c\x81\x0c\x9f\x0c\xd1\r\x03\n\xc9\n\xab\n\xab\nG\r\xfd\x0ea\r\xfd\x0e\xf7\x0b\x0f\n\xab\x0c\x9f\n\xab\x00\n\rH\x00\x0f\x00\x05\x03\xc0\x00\x96\x00d\x00F\x002mm94\x000\x00<\x00\xf0\x00\n\x00\x07\x00\x00\x00\r\x00\x00\x01\xf4\x01,\x16\x80\x00\xb4\xffL\x00\x05\x00\x08\xea\x90'), 1: bytearray(b'')} 2024-07-07 14:20:47.719 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (start): bytearray(b'\x01\x04"\x14\xd0\x05\n94m`\x00\xe5\x02\x0b\x03\xe7\x00\n\r\x01\x0b\x8b\r\x03\r\x00\x0b\x8e\x0b\x88\x00\x00\x00\xb4\x00\xb4\x089') 2024-07-07 14:20:48.053 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (start): bytearray(b'\x01\x044\r\x00\r\x02\r\x01\r\x03\r\x02\r\x03\r\x02\r\x03\r\x02\r\x02\r\x01\r\x03\r\x02\r\x02\r\x01\r\x02\x0b\x8e\x0b\x88\x0b\x89\x0b\x8e\n\xab\n\xab\n\xab\n\xab\x0b\xa5\x0b\x96\xcdB') 2024-07-07 14:20:48.054 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx data CRC is invalid: 17101 != 17101 or wrong message bytearray(b'\x01\x044') 2024-07-07 14:20:48.421 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx BLE data (cnt.): bytearray(b'\x01\x01\x12\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\xda\xaa') 2024-07-07 14:20:48.422 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] (SP05B2312190075 ) Rx data CRC is invalid: 1072452639466660455102030825171179442875314777524001898054349 != 1072452639466660455102030825171179442875314777524001898054349 or wrong message bytearray(b'\x01\x044') 2024-07-07 14:21:01.320 DEBUG (MainThread) [custom_components.bms_ble] BMS SP05B2312190075 data update 2024-07-07 14:21:01.321 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] BMS SP05B2312190075 already connected 2024-07-07 14:21:01.321 DEBUG (MainThread) [custom_components.bms_ble] BMS data sample {'delta_voltage': 0.004, 'temperature': 22.4, 'voltage': 0.0, 'current': 0.0, 'cycle_charge': 0.0, 'battery_level': 0.0, 'cycles': 0, 'cycle_capacity': 0.0, 'power': 0.0, 'battery_charging': False, 'rssi': -69} 2024-07-07 14:21:01.322 INFO (MainThread) [custom_components.bms_ble] Fetching SP05B2312190075 data recovered 2024-07-07 14:21:01.322 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching SP05B2312190075 data in 0.002 seconds (success: True) 2024-07-07 14:21:07.366 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 42:54:6F:61:D9:60 2024-07-07 14:21:08.402 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 42:54:6F:61:D9:60 2024-07-07 14:21:10.400 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 42:54:6F:61:D9:60 2024-07-07 14:21:22.402 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 42:54:6F:61:D9:60 2024-07-07 14:21:29.404 INFO (MainThread) [habluetooth.scanner] hci0 (DC:A6:32:BD:B1:58): Bluetooth scanner has gone quiet for 90s, restarting 2024-07-07 14:21:31.321 DEBUG (MainThread) [custom_components.bms_ble] BMS SP05B2312190075 data update 2024-07-07 14:21:31.321 DEBUG (MainThread) [custom_components.bms_ble.plugins.seplos_bms] BMS SP05B2312190075 already connected 2024-07-07 14:21:34.402 INFO (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Discovered Bluetooth LE device 42:54:6F:61:D9:60 2024-07-07 14:21:41.324 DEBUG (MainThread) [custom_components.bms_ble] Device communication timeout 2024-07-07 14:21:41.325 ERROR (MainThread) [custom_components.bms_ble] Timeout fetching SP05B2312190075 data 2024-07-07 14:21:41.325 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching SP05B2312190075 data in 10.004 seconds (success: False)

image

So we are missing the request data routine.

Goaheadz commented 1 day ago

sorry for long text.

App from seplos (apk) is available from seplos website

patman15 commented 1 day ago

So we are missing the request data routine.

We are missing the command to enable the data reporting, yes.

I made a small fix, so you should finally see all data (at least if you start the app as well) :sunglasses:

App from seplos (apk) is available from seplos website

Can you send me a link? I can't find it. https://seplos.com does not work for me (403 forbidden) and on https://seplos.tech I can't find an app.

sorry for long text.

Still helped a lot to improve the code, but attachments preferred. :innocent:

patman15 commented 22 hours ago

App from seplos (apk) is available from seplos website

Can you send me a link? I can't find it. https://seplos.com does not work for me (403 forbidden) and on https://seplos.tech I can't find an app.

Finally found something. I will setup a fake battery to checkout the app and determine the commands. I'll report back when I succeeded or got totally stuck.

Goaheadz commented 22 hours ago

Cant upload apk here. File zip is 26MB only 25MB allowed to be uploaded.

You can download it in link below, but you need to create an account. https://www.seplos.com/download.html

Goaheadz commented 21 hours ago

nothing is changing. and.no rx data ble log :(

we are at the point that its all on you :) It would be faster and simpler if you could install app and check messages. (I know you dont have that bms)

But I am available for all your needs for testing

Let me know next steps