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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions custom_components/bms_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@
"local_name": "SX1*",
"service_uuid": "0000ff00-0000-1000-8000-00805f9b34fb"
},
{
"local_name": "LT40AH",
"service_uuid": "0000ff00-0000-1000-8000-00805f9b34fb"
},
{
"manufacturer_id": 8856,
"service_uuid": "0000ff00-0000-1000-8000-00805f9b34fb"
},
{
"manufacturer_id": 15984,
"service_uuid": "0000ff00-0000-1000-8000-00805f9b34fb"
},
{
"manufacturer_id": 49572,
"service_uuid": "0000ff00-0000-1000-8000-00805f9b34fb"
},
{
"local_name": "SP0*",
Expand Down
8 changes: 4 additions & 4 deletions custom_components/bms_ble/plugins/jbd_bms.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def matcher_dict_list() -> list[dict[str, Any]]:
"service_uuid": BMS.uuid_services()[0],
"connectable": True,
}
for pattern in ["SP0?S*", "SP1?S*", "SP2?S*", "GJ-*", "SX1*"]
for pattern in ["SP0?S*", "SP1?S*", "SP2?S*", "GJ-*", "SX1*", "LT40AH"]
] + [
{ # ECO-WORTHY LiFePO4 12V 100Ah
{ # ECO-WORTHY LiFePO4 12V 100Ah, LISMART1240LX/LISMART1255LX, XL19110253
"service_uuid": BMS.uuid_services()[0],
"manufacturer_id": 0x2298,
"manufacturer_id": manufacturer_id,
"connectable": True,
}
} for manufacturer_id in [0x2298, 0x3e70, 0xc1a4]
]

@staticmethod
Expand Down
25 changes: 25 additions & 0 deletions tests/advertisement_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,29 @@
),
"jbd_bms",
),
( # source bluetoothctl (https://github.com/patman15/BMS_BLE-HA/issues/141)
generate_advertisement_data( # https://liontron.com/download/german/LISMART1240LX.pdf
service_uuids=["0000ff00-0000-1000-8000-00805f9b34fb"],
manufacturer_data={15984: "\x97\xd1\xc1\x8c"}, # MAC address, correct
rssi=-53,
),
"jbd_bms",
),
( # source bluetoothctl (https://github.com/patman15/BMS_BLE-HA/issues/174)
generate_advertisement_data( # LionTron XL19110253
service_uuids=["0000ff00-0000-1000-8000-00805f9b34fb"],
manufacturer_data={49572: "\x38\x99\x15\x54"}, # MAC address, correct
rssi=-53,
),
"jbd_bms",
),
( # source bluetoothctl (https://github.com/patman15/BMS_BLE-HA/issues/174)
generate_advertisement_data( # LionTron LT40AH
local_name="LT40AH",
service_uuids=["0000ff00-0000-1000-8000-00805f9b34fb"],
manufacturer_data={19011: "\x1B\x38\xC1\xA4"}, # MAC address, wrong
rssi=-53,
),
"jbd_bms",
),
]