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 Liontron battery detection #146

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

patman15
Copy link
Owner

@patman15 patman15 commented Jan 10, 2025

needs verification, so if someone out there has a Liontron battery and can try this version to verify it's working, that would be helpful!

@patman15 patman15 linked an issue Jan 10, 2025 that may be closed by this pull request
4 tasks
@patman15 patman15 added help wanted Extra attention is needed more info needed labels Jan 10, 2025
@iNETTechnik
Copy link

iNETTechnik commented Feb 8, 2025

it works , batteries shown ! great work . many many thanks.
but seems Liontron Batts get no connection. get device communication timeout.

[core-ssh 0downloads]$ bluetoothctl info A4:C1:38:99:15:54
Unable to open mgmt_socket
Device A4:C1:38:99:15:54 (public)
        Name: XL19110253
        Alias: XL19110253
        Paired: no
        Bonded: no
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
        UUID: Unknown                   (00001912-0000-1000-8000-00805f9b34fb)
        UUID: Unknown                   (0000ff00-0000-1000-8000-00805f9b34fb)
        ManufacturerData Key: 0xc1a4 (49572)
        ManufacturerData Value:
  38 99 15 54                                      8..T            
        RSSI: 0xffffffb9 (-71)
        AdvertisingFlags:
  06                                               .               
[CHG] Device ED:ED:3B:70:D9:4B RSSI: 0xffffffad (-83)
[CHG] Device ED:ED:3B:70:D9:4B ManufacturerData Key: 0x05a7 (1447)
[CHG] Device ED:ED:3B:70:D9:4B ManufacturerData Value:
  98 e7 82 8c 16 56 30 96 e9                       .....V0..       
[CHG] Device 9C:8C:6E:EC:77:FB RSSI: 0xffffffac (-84)
[CHG] Device 9C:8C:6E:EC:77:FB ManufacturerData Key: 0x0075 (117)
[CHG] Device 9C:8C:6E:EC:77:FB ManufacturerData Value:
  42 04 01 20 6f 17 07 00 00 00 00 00 00 00 00 00  B.. o...........
  00 00 00 00 00 00 00 00                          ........     

no idea if this are the correct log:

2025-02-08 15:36:45.864 homeassistant bluetoothd[3209]: No matching connection for device
2025-02-08 15:37:04.764 homeassistant bluetoothd[3209]: No matching connection for device
2025-02-08 15:37:46.874 homeassistant bluetoothd[3209]: No matching connection for device
2025-02-08 15:38:12.854 homeassistant bluetoothd[3209]: No matching connection for device
2025-02-08 15:38:26.753 homeassistant kernel: Bluetooth: hci0: Opcode 0x200e failed: -16
2025-02-08 15:38:34.804 homeassistant bluetoothd[3209]: No matching connection for device

2025-02-08 16:43:07.296 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: device communication timed out
2025-02-08 16:43:07.296 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching XL19110253 data in 11.653 seconds (success: False)
2025-02-08 16:43:07.297 DEBUG (MainThread) [custom_components.bms_ble] Shutting down BMS device (XL19110253)
2025-02-08 16:43:07.297 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: disconnecting BMS
2025-02-08 16:43:09.720 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: disconnected from BMS
2025-02-08 16:43:12.463 DEBUG (MainThread) [custom_components.bms_ble] Setup of <ConfigEntry entry_id=01JKK311X7KFTW09GXENDWJEW0 version=1 domain=bms_ble title=XL19110253 state=ConfigEntryState.SETUP_IN_PROGRESS unique_id=A4:C1:38:99:15:54>
2025-02-08 16:43:12.463 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: initializing Jiabaida Smart BMS, BT address: A4:C1:38:99:15:54
2025-02-08 16:43:12.464 DEBUG (MainThread) [custom_components.bms_ble] Initializing coordinator for XL19110253 (A4:C1:38:99:15:54) as Jiabaida Smart BMS
2025-02-08 16:43:12.464 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: advertisement: {'name': 'XL19110253', 'address': 'A4:C1:38:99:15:54', 'rssi': -90, 'manufacturer_data': {49572: b'8\x99\x15T'}, 'service_data': {}, 'service_uuids': ['00001800-0000-1000-8000-00805f9b34fb', '00001912-0000-1000-8000-00805f9b34fb', '0000ff00-0000-1000-8000-00805f9b34fb'], 'source': 'F4:4E:FC:97:4A:89', 'advertisement': AdvertisementData(local_name='XL19110253', manufacturer_data={49572: b'8\x99\x15T'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001912-0000-1000-8000-00805f9b34fb', '0000ff00-0000-1000-8000-00805f9b34fb'], rssi=-90), 'device': BLEDevice(A4:C1:38:99:15:54, XL19110253), 'connectable': True, 'time': 258763.113835717, 'tx_power': None}
2025-02-08 16:43:12.464 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: BMS data update
2025-02-08 16:43:12.464 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: connecting BMS
2025-02-08 16:43:12.465 DEBUG (MainThread) [bleak_retry_connector] A4:C1:38:99:15:54 - A4:C1:38:99:15:54: Connection attempt: 1
2025-02-08 16:43:14.992 DEBUG (MainThread) [bleak_retry_connector] A4:C1:38:99:15:54 - A4:C1:38:99:15:54: Connected after 1 attempts
2025-02-08 16:43:15.635 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: TX BLE data: dd a5 03 00 ff fd 77
2025-02-08 16:43:26.105 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: device communication timed out
2025-02-08 16:43:26.105 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching XL19110253 data in 13.641 seconds (success: False)
2025-02-08 16:43:26.106 DEBUG (MainThread) [custom_components.bms_ble] Shutting down BMS device (XL19110253)
2025-02-08 16:43:26.106 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: disconnecting BMS
2025-02-08 16:43:28.749 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: disconnected from BMS
2025-02-08 16:43:36.425 DEBUG (MainThread) [custom_components.bms_ble] Setup of <ConfigEntry entry_id=01JKK311X7KFTW09GXENDWJEW0 version=1 domain=bms_ble title=XL19110253 state=ConfigEntryState.SETUP_IN_PROGRESS unique_id=A4:C1:38:99:15:54>
2025-02-08 16:43:36.425 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: initializing Jiabaida Smart BMS, BT address: A4:C1:38:99:15:54
2025-02-08 16:43:36.426 DEBUG (MainThread) [custom_components.bms_ble] Initializing coordinator for XL19110253 (A4:C1:38:99:15:54) as Jiabaida Smart BMS
2025-02-08 16:43:36.426 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: advertisement: {'name': 'XL19110253', 'address': 'A4:C1:38:99:15:54', 'rssi': -89, 'manufacturer_data': {49572: b'8\x99\x15T'}, 'service_data': {}, 'service_uuids': ['00001800-0000-1000-8000-00805f9b34fb', '00001912-0000-1000-8000-00805f9b34fb', '0000ff00-0000-1000-8000-00805f9b34fb'], 'source': 'F4:4E:FC:97:4A:89', 'advertisement': AdvertisementData(local_name='XL19110253', manufacturer_data={49572: b'8\x99\x15T'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001912-0000-1000-8000-00805f9b34fb', '0000ff00-0000-1000-8000-00805f9b34fb'], rssi=-89), 'device': BLEDevice(A4:C1:38:99:15:54, XL19110253), 'connectable': True, 'time': 258789.593861632, 'tx_power': None}
2025-02-08 16:43:36.426 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: BMS data update
2025-02-08 16:43:36.426 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: connecting BMS
2025-02-08 16:43:36.426 DEBUG (MainThread) [bleak_retry_connector] A4:C1:38:99:15:54 - A4:C1:38:99:15:54: Connection attempt: 1
2025-02-08 16:43:36.848 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: disconnected from BMS
2025-02-08 16:43:37.313 DEBUG (MainThread) [bleak_retry_connector] A4:C1:38:99:15:54 - A4:C1:38:99:15:54: Connected after 1 attempts
2025-02-08 16:43:37.904 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: TX BLE data: dd a5 03 00 ff fd 77
2025-02-08 16:43:48.375 DEBUG (MainThread) [custom_components.bms_ble] XL19110253: device communication timed out
2025-02-08 16:43:48.375 DEBUG (MainThread) [custom_components.bms_ble] Finished fetching XL19110253 data in 11.949 seconds (success: False)
2025-02-08 16:43:48.376 DEBUG (MainThread) [custom_components.bms_ble] Shutting down BMS device (XL19110253)
2025-02-08 16:43:48.376 DEBUG (MainThread) [custom_components.bms_ble.plugins.jbd_bms] LT40AH[4A:43]: disconnecting BMS

@iNETTechnik
Copy link

@patman15
Copy link
Owner Author

patman15 commented Feb 9, 2025

no idea if this are the correct log

It is fine! For details, please see the troubleshooting guide. For longer snippets, please attach them as file, to not spoil the issue. Thanks!

I wonder, if you have an issue with your BT setup:

2025-02-08 15:38:26.753 homeassistant kernel: Bluetooth: hci0: Opcode 0x200e failed: -16

That sounds a bit suspicious. What HA setup did you use and which BT adapter?

If you think it is ok, I would need you to capture the Bluetooth traffic on Android or iOS while using the vendor app with the battery. Probably, there are unlock commands or similar missing because according to the log, the BMS does not respond to the requests.

@iNETTechnik
Copy link

HA with HA Green.
Yes BT dongle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BLE Battery Management No supported devices found via Bluetooth. Liontron Batteries
2 participants