Closed shum-elli closed 2 months ago
What do you know about the BMS? Please provide as much details as you can.
app_unpack.zip wechat_miniprogram_unpack.zip seller give me two way to view information. I use some unpack tools to unpack it.Seller do some Obfuscation in program. The app is difficult to understand. Wechat Miniprogrammar is easier to understand, but i'm not good at dealing this.I try to nrf connect to get information directly,but I failed.
Do you know how to prepare a btsnoop capture of the BLE traffic?
Please give it a try: https://medium.com/@charlie.d.anderson/how-to-get-the-bluetooth-host-controller-interface-logs-from-a-modern-android-phone-d23bde00b9fa
Are you able to talk to the BMS using the WeChat examples?
bluetooth log,i have collected. In the log ,my device name is realmech,Bms board name is Baken btsnoop_hci_20240623_002937.zip
-> Write Request (0x12) to handle 0x0011 -> Subscribe notifications
-> Write Command (0x52) to handle 0x0013: c56500bc614e
<- Notification received: 0100030041b8e6b8000000000000000041d59f3041cd0b30429d9320424753ec00343f6e00010027
-> Write Command (0x52) to handle 0x0013: c56500bc614e
<- Notification received: 0100030041b8e75c000000000000000041d59f3041cd10e0429d9320424753ec00343f6f00010027
-> Write Command (0x52) to handle 0x0013: c56500bc614e
<- Notification received: 0100030041b8e70a000000000000000041d5a4e041cd10e0429d9320424753ec00343f7000010027
-> Write Command (0x52) to handle 0x0013: c56500bc614e
<- Notification received: 0100030041b8e666000000000000000041d59f3041cd1680429d9320424753ec00343f7100010027
-> Write Command (0x52) to handle 0x0013: c56500bc614e
<- Notification received: 0100030041b8e615000000000000000041d5997041cd0590429d9320424753ec00343f7300010027
btsnoop-reduced.json btsnoop-reduced.log
$ cat btsnoop-reduced.json | grep btatt.val | cut -d\" -f4
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e6:b8:00:00:00:00:00:00:00:00:41:d5:9f:30:41:cd:0b:30:42:9d:93:20:42:47:53:ec:00:34:3f:6e:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e7:5c:00:00:00:00:00:00:00:00:41:d5:9f:30:41:cd:10:e0:42:9d:93:20:42:47:53:ec:00:34:3f:6f:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e7:0a:00:00:00:00:00:00:00:00:41:d5:a4:e0:41:cd:10:e0:42:9d:93:20:42:47:53:ec:00:34:3f:70:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e6:66:00:00:00:00:00:00:00:00:41:d5:9f:30:41:cd:16:80:42:9d:93:20:42:47:53:ec:00:34:3f:71:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e6:15:00:00:00:00:00:00:00:00:41:d5:99:70:41:cd:05:90:42:9d:93:20:42:47:53:ec:00:34:3f:73:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e5:70:00:00:00:00:00:00:00:00:41:d5:99:70:41:cd:05:90:42:9d:93:20:42:47:53:ec:00:34:3f:74:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e5:c2:00:00:00:00:00:00:00:00:41:d5:99:70:41:cd:05:90:42:9d:93:20:42:47:53:ec:00:34:3f:75:00:01:00:27
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e5:c2:00:00:00:00:00:00:00:00:41:d5:99:70:41:cd:10:e0:42:9d:93:20:42:47:53:ec:00:34:3f:76:00:01:00:27
86:00:00:bc:61:4e
21:1d:1a:e3
85:55:00:bc:61:4e
c5:65:00:bc:61:4e
01:00:03:00:41:b8:e3:d7:00:00:00:00:00:00:00:00:41:d5:8e:10:41:cc:fa:40:42:9d:93:20:42:47:53:ec:00:34:3f:81:00:01:00:27
Could you provide some screenshots of the android app? I would like to know the measurements shown at the app.
Could you please provide a contact for a chat software, similar to Discord? I think it seems more conveniently
this is Wechat MiniProgrammar view,the original is Chinese, i have translated it to english
I've started the implementation but it's in early stage.
const { buffer } = new Uint8Array([65,184,230,184]);
const dataview = new DataView(buffer);
console.log(dataview.getFloat32(0))
> 23.112655639648438
Wow. Even opened a separate project. Thank you very much for helping me.
const { buffer } = new Uint8Array([65,184,230,184]); const dataview = new DataView(buffer); console.log(dataview.getFloat32(0)) > 23.112655639648438
I think this is the right data.
But for me,the most difficult problem is how to get value,I'm puzzled at how to communicate with BMS.I'm a bluetooth newbie.
I could provide usb share service(bluetooth device) or remote desktop to help debug
Wow, I get ,c56500bc614e this is the get data command.
Could you prepare another btsnoop capture of the other views? It looks like we are retrieving the status frame only at the moment. There should be a cell voltages
frame and a settings
frame too. Could you also trigger the mosfet switches a few times?
I will implement the decoder later the week. At the moment the floats aren't decided properly.
I have done some capture to cap this command. MOSFET I have tested. It's right. Maybe I think settings is not necessary to use esphome
5b6500bc614e , this is the cell voltage view command 860000bc614e , turn off discharge 855500bc614e , turn on discharge d88800bc614e , turn on charge d90000bc614e , turn off charge
How many cells does the BMS support? Could you provide the model name of your BMS and/or a photo?
6-8 cells
Does the capture include a settings frame too? I would like to print the settings into the log.
Does the capture include a settings frame too? I would like to print the settings into the log.
No,I don't catch it. I will Re-prepare one for setting view
This ESPHome helper method should be used to decode the float32 measurements:
float converted_value = esphome::decode_float(bytes);
2024-06-24-15-12-13.zip settings view is complex,i have recorded my operation
The component is able to decode the status frame
now. Please give it a try! :-)
[20:42:39][I][lolan_bms_ble:122]: Status frame received
[20:42:39][D][lolan_bms_ble:123]: 01.00.02.00.41.B9.02.90.00.00.00.00.00.00.00.00.41.D7.D9.B0.41.CD.60.00.42.9D.93.20.42.47.9E.44.00.36.3E.5A.00.01.00.27 (40)
[20:42:39][I][lolan_bms_ble:129]: Switch bitmask: 2
[20:42:39][I][lolan_bms_ble:132]: Status bitmask: 0
[20:42:39][I][lolan_bms_ble:135]: Total voltage: 23.13 V
[20:42:39][I][lolan_bms_ble:140]: Current: 0.00 A
[20:42:39][I][lolan_bms_ble:141]: Current: 0.00 A
[20:42:39][I][lolan_bms_ble:144]: Temperature 1: 26.98 °C
[20:42:39][I][lolan_bms_ble:147]: Temperature 2: 25.67 °C
[20:42:39][I][lolan_bms_ble:150]: Total discharging energy: 78.79 Ah
[20:42:39][I][lolan_bms_ble:153]: Total charging energy: 49.90 Ah
[20:42:39][I][lolan_bms_ble:156]: Total runtime: 3554906 S
[20:42:39][I][lolan_bms_ble:157]: Total runtime: 41d 3h
[20:42:39][I][lolan_bms_ble:160]: Charging cycles: 1
[20:42:39][I][lolan_bms_ble:163]: State of charge: 39 %
Very good progress. I've tried this.And I've get the right date.
Perfect! The measurements aren't published yet. The NA
states at the web interface are fine for now.
Much obliged.
Could you tell me the password / pin number which is required if you use the app?
The update version is able to publish some measurements now. Please update your YAML.
The default password is “12345678”.
Convert to hex is “bc614e”,the end of the command
It looks like all data works good. I've test discharge.The current is right,But the power is zero.I think it's not a big problem,just multipy current & voltage.I've read some code in seller's program,It obtained by this way. About charge, I need wait until tomorrow and test.Because now the sun has set,PV board doesn't work.
I know what's going on. I will fix the power sensor tomorrow.
Got it.Today I've tested charging. The charge current & power is all right.
The component is able to publish the most important measurements now. Please update your YAML and give it another try!
Wow,it looks like Completeness is almost 100%. Except some change component
I have to ask again: Did you make the btsnoop captures using the wechat mini program or the second obfuscated app?
Actually,I use the second obfuscated app to make the btsnoop captures, if you need i can make a new one for you.The capture phone doesn't login wechat, so i use the second app like the screen capture do.
I'm asking because the request payloads of the wechat app doesn't match exactly with the captured payloads. No action needed. I will use the captured commands to be safe.
Could you capture the reset of the different counters too? There should be a button to reset the charging cycle counter and the total charged/discharged energy counter.
I have searched everywhere in wechat miniprogram & app , I don't find a button or other way to restore the counter. I think maybe it is not supported. ┭┮﹏┭┮ Maybe only disconnect battery to it can restore it.
It's supported by this implementation now. Please update your YAML and to a clean build. The Mosfets can be controlled now and some counters can be resetted using buttons. Please don't test the factory reset
. ;-)
Except factory reset, I have test all button function is right, But I think it lacks two data, total charging energy & total discharging energy, I have saw them in log output, but i don't see config in sensor.py
I will add these sensors soon.
The basic implementation is complete now. Feel free to create new issues if you miss something!
I'm still playing around. Could you provide some more settings frames? They can be retrieve using the retrieve settings button
if you don't want to do another btsnoop capture.
我还在玩。你能提供更多的设置框架吗?如果您不想再进行一次 btsnoop 捕获,可以使用 来检索它们。
retrieve settings button
Tomorrow I will take a btsnoop capture again.
Thanks!
https://drive.google.com/file/d/1P6zqe02axp4mUClfG7xCjVYJqLPksznm/view?usp=sharing
It was too hot during the day, so I collected this data after dinner.The file has included screen record, So it exceed github file upload limit,I upload it to google cloud.
03:6c:00:bc:61:4e:0c:00:00:32:00:50:08:0f:07:01:ff:fa:00:02:42:51:09:41:40:56:66:66:3f:80:00:00:40:b7:95:81:40:b2:b8:52:41:9a:00:00:41:cc:00:00:40:30:00:00:40:69:99:9a:42:82:00:00:42:82:00:00:46:1c:40:00:cc:10:f1:52:01:34:8b:9a:40:30:00:00:40:53:33:33:3c:23:d7:0a:41:c0:cc:cd:40:5c:cc:cd:41:a2:66:66:40:39:99:9a:5d:c4:5a:a5
03:6c:05:39:7f:b1:0c:00:00:32:00:50:08:0f:07:01:ff:fa:00:02:42:51:09:41:40:56:66:66:3f:80:00:00:40:b7:95:81:40:b2:b8:52:41:99:99:9a:41:cc:00:00:40:30:00:00:40:6a:3d:71:42:82:00:00:42:82:00:00:46:1c:40:00:cc:10:f1:52:01:34:8b:9a:40:30:00:00:40:53:33:33:3c:23:d7:0a:41:c0:cc:cd:40:5c:cc:cd:41:a2:66:66:40:39:99:9a:13:f4:5a:a5
Thanks!
I want to adapte lolan bms to esphome,but i meet some problems,Could you help me to analysis