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 12v 100a Ecoworthy battery #164

Open
4 tasks done
nezra opened this issue Feb 2, 2025 · 15 comments
Open
4 tasks done

add 12v 100a Ecoworthy battery #164

nezra opened this issue Feb 2, 2025 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@nezra
Copy link

nezra commented Feb 2, 2025

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.

Would like the Ecoworthy 100AH IOT battery & BW02 adaptor. from the ESPhome BT proxy using VERY_VERBOSE

[13:38:02][VV][esp32_ble_tracker:434]: Parse Result:
[13:38:02][VV][esp32_ble_tracker:453]: Address: B4:C2:E0:FA:B8:F0 (PUBLIC)
[13:38:02][VV][esp32_ble_tracker:456]: RSSI: -30
[13:38:02][VV][esp32_ble_tracker:457]: Name: 'ECO-WORTHY 02_B8EF'
[13:38:02][VV][esp32_ble_tracker:465]: Ad Flag: 6
[13:38:02][VV][esp32_ble_tracker:479]: Manufacturer ID: 0xC2B4, data: E0.FA.B8.F0
[13:38:02][VV][esp32_ble_tracker:489]: Adv data: 02.01.06.13.09.45.43.4F.2D.57.4F.52.54.48.59.20.30.32.5F.42.38.45.46.07.FF.B4.C2.E0.FA.B8.F0 (31)
[13:38:09][V][bluetooth_proxy:058]: Proxying raw packet from B4:C2:E0:FA:B8:F0, length 31. RSSI: -29 dB
[13:38:14][VV][api.service:345]: send_bluetooth_le_raw_advertisements_response:
BluetoothLERawAdvertisementsResponse {
advertisements: BluetoothLERawAdvertisement {
address: 198749091182832
rssi: -30
address_type: 0
data: '���� ECO-WORTHY 02_B8EF�\xff\xb4\xc2\xe0\xfa\xb8\xf0'
}
}

calculated out - 0xC2B4 -> 49844

i don't have a bluetooth adaptor, just an ESPhome BT Proxy; which works fine for the other BLE device & Integration i have, (a ruuvi tag); so i can't run bluetoothctl commands from the terminal. I also can't add Debug to the integration, since it refuses to start/be added; with the only error "No supported devices found via Bluetooth."; so i can't get the service uuid

Additional context

came here, from here: https://community.home-assistant.io/t/eco-worthy-100ah-iot-battery-integration/792000/4

the 100ah and 280ah(mentioned in the post above) versions share the same bw02 adaptor.

Battery details here: https://www.eco-worthy.com/collections/lithium-batteries/products/lifepo4-12v-100ah-lithium-battery-with-bluetooth-and-battery-status-display-100a-bms-with-low-temperature-protection

@nezra nezra added the enhancement New feature or request label Feb 2, 2025
@nezra
Copy link
Author

nezra commented Feb 2, 2025

managed to locate the Service UUID

0000ff00-0000-1000-8000-00805f9b34fb

Looks to match the other eco-worthy batteries in Manifest.json

@patman15
Copy link
Owner

patman15 commented Feb 2, 2025

Hi @nezra! Please try the linked branch in this ticket via manual install and provide me a debug log, so I can verify the detection and add matching tests for the future.

@patman15 patman15 self-assigned this Feb 2, 2025
@nezra
Copy link
Author

nezra commented Feb 2, 2025

Thanks @patman15 !

Returned this:

and attempting to add it yielded this from step 7.:
Image

i can't enable debug to display anything, since there is no option to do so from the troubleshooting steps:
Image

question, shouldn't the management_id list in jbd_bms.py have the hex code of 0xc2b4 like the other ones; and not the DEC equivelent? either dec or hex in the management_id list still yields the same result as above though.

i did add a BT adapter, and i can connect &disconnect the device.

and i verified the BLE device isn't paired or connected to anything else just in case.

Image

@patman15
Copy link
Owner

patman15 commented Feb 2, 2025

@nezra The adapter (in contrast to the normal batteries) seems not to broadcast the service_id. I removed it, can you please try again?

@nezra
Copy link
Author

nezra commented Feb 2, 2025

@patman15
one step closer. It let me add the integration, and it now shows up; but with an error:

Image

oh. and i really appreciate all of the time and patience with this.

@patman15
Copy link
Owner

patman15 commented Feb 2, 2025

Uh, that's not good. That hints towards a different setup. Can you please see if you are able to capture the Bluetooth traffic on Android or iOS while using the vendor app with the battery?
Unfortunately, I need more info.

@nezra
Copy link
Author

nezra commented Feb 2, 2025

@patman15

i've been able to connect to it with 3rd party tools; but i am not sure how to watch the BT traffic on it when it's connected to the app. It only connects to one at a time.

not sure if this is what you mean. the notify option flips between 0xA1 and 0xA2. here are some samples:

Image

Image

from what i was able to glean from the post that sent me here, there's the following:

0xA1
Position
0-5 MAC address
6 Packet Type
22-23 Available capacity
24-25 Total capacity (0x64 =100)
26-27 Battery voltage (centivolts)
28-29 Battery load (centi-amps) signed int so 0x0001 = 1 = 0.01A 0x8000 = -1 = -0.01A

0xA2
Position
0-5 MAC address
6 Packet Type
21 Number of cells (reads 4)
22-23 Cell 1 voltage (mv)
24-25 Cell 2 voltage (mv)
26-27 Cell 3 voltage (mv)
28-29 Cell 4 voltage (mv)
30-85 (Unused but could be further cell voltages if larger battery)
86-87 Number of cells (0 indexed - reads 3)

i did buy and slap a BT adapter in my machine, and i can connect & disconnect to it through bluetoothctl if that helps from the HA terminal.

@nezra
Copy link
Author

nezra commented Feb 2, 2025

Oh! and because it at least connected, i was able to get this now in case it's needed:

2025-02-02 09:45:05.987 DEBUG (MainThread) [custom_components.bms_ble] Setup of <ConfigEntry entry_id=01JK3GXD0XATXCQST4BXZ0K41J version=1 domain=bms_ble title=ECO-WORTHY 02_B8EF state=ConfigEntryState.SETUP_IN_PROGRESS unique_id=B4:C2:E0:FA:B8:F0>
2025-02-02 09:45:05.988 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] ECO-WORTHY 02_B8EF[B8:F0]: initializing Jiabaida Smart BMS, BT address: B4:C2:E0:FA:B8:F0
2025-02-02 09:45:05.988 DEBUG (MainThread) [custom_components.bms_ble] Initializing coordinator for ECO-WORTHY 02_B8EF (B4:C2:E0:FA:B8:F0) as Jiabaida Smart BMS
2025-02-02 09:45:05.988 DEBUG (MainThread) [custom_components.bms_ble] ECO-WORTHY 02_B8EF: advertisement: {'name': 'ECO-WORTHY 02_B8EF', 'address': 'B4:C2:E0:FA:B8:F0', 'rssi': -42, 'manufacturer_data': {49844: b'\xe0\xfa\xb8\xf0'}, 'service_data': {}, 'service_uuids': ['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '0000fff0-0000-1000-8000-00805f9b34fb'], 'source': '74:3A:F4:FF:9C:B2', 'advertisement': AdvertisementData(local_name='ECO-WORTHY 02_B8EF', manufacturer_data={49844: b'\xe0\xfa\xb8\xf0'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '0000fff0-0000-1000-8000-00805f9b34fb'], rssi=-42), 'device': BLEDevice(B4:C2:E0:FA:B8:F0, ECO-WORTHY 02_B8EF), 'connectable': True, 'time': 4008.483948946, 'tx_power': None}
2025-02-02 09:45:05.988 DEBUG (MainThread) [custom_components.bms_ble] ECO-WORTHY 02_B8EF: BMS data update
2025-02-02 09:45:05.988 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] ECO-WORTHY 02_B8EF[B8:F0]: connecting BMS
2025-02-02 09:45:05.989 DEBUG (MainThread) [bleak_retry_connector] B4:C2:E0:FA:B8:F0 - B4:C2:E0:FA:B8:F0: Connection attempt: 1
2025-02-02 09:45:06.832 DEBUG (MainThread) [bleak_retry_connector] B4:C2:E0:FA:B8:F0 - B4:C2:E0:FA:B8:F0: Connected after 1 attempts
2025-02-02 09:45:06.832 INFO (MainThread) [custom_components.bms_ble.plugins.jbd_bms] ECO-WORTHY 02_B8EF[B8:F0]: failed to initialize BMS connection (BleakCharacteristicNotFoundError)
2025-02-02 09:45:06.832 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] ECO-WORTHY 02_B8EF[B8:F0]: disconnecting BMS
2025-02-02 09:45:09.281 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] ECO-WORTHY 02_B8EF[B8:F0]: disconnected from BMS
2025-02-02 09:45:09.281 DEBUG (MainThread) [custom_components.bms_ble] ECO-WORTHY 02_B8EF: device communicating failed: Characteristic ff01 was not found! (BleakCharacteristicNotFoundError)
2025-02-02 09:45:09.281 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching ECO-WORTHY 02_B8EF data in 3.293 seconds (success: False)
2025-02-02 09:45:09.282 DEBUG (MainThread) [custom_components.bms_ble] Shutting down BMS device (ECO-WORTHY 02_B8EF)

@nezra
Copy link
Author

nezra commented Feb 2, 2025

@patman15

Think i got it. it's the whole log. let me know if you need the "BT SNOOP" variant instead.

@patman15
Copy link
Owner

patman15 commented Feb 2, 2025

BT snoop would be easier for me, thanks.

@nezra
Copy link
Author

nezra commented Feb 2, 2025

Untitled 2.log

@patman15

Attached.

@patman15
Copy link
Owner

patman15 commented Feb 2, 2025

Perfect, but this is a new type of protocol so I need to do a bit more work to get it integrated. Does not seem to be too complicated but it requires a few sessions of a few hours. I have been ordered out of the country next week, so this will unfortunately need to wait till I'm back to my PC, unless you want to try yourself.

@patman15 patman15 removed their assignment Feb 2, 2025
@nezra
Copy link
Author

nezra commented Feb 2, 2025

i may have to wait on this one. it's about 2 steps outside of my knowledge and understanding.

a few things i did notice.

I initially said the service id was 0000ff00-0000-1000-8000-00805f9b34fb; but it turns out it's 0000fff0-0000-1000-8000-00805f9b34fb. This probably started me down the wrong path; and maybe why the services id caused an issue before?

3 F's in the first part; not 2.

if i am learning anything from this, does this then mean the UUID TX should be fff2; and the RX should be fff1; and the uuid services id should be fff0 based on the images above from the custom service/characteristic?

Given the two different headers; i'm assuming it(head_rsp) needs to be handled with an if/elif statement; bit in init like with ogt_bms.py?

@Scope666
Copy link

Scope666 commented Feb 3, 2025

Sounds like I might be in a similar boat ... my ECO-WORTHY 150 AH (metal case) battery is only a few months old, perhaps they updated the BMS chip again.

#169

@patman15
Copy link
Owner

patman15 commented Feb 8, 2025

Sounds like I might be in a similar boat ... my ECO-WORTHY 150 AH (metal case) battery is only a few months old, perhaps they updated the BMS chip again.

It's unfortunately not the same issue, here they really changed the BMS, for yours, @Scope666 it was just the auto-detection.

@patman15 patman15 self-assigned this Feb 8, 2025
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

When branches are created from issues, their pull requests are automatically linked.

3 participants