Skip to content

Commit

Permalink
adapted Ective identification
Browse files Browse the repository at this point in the history
  • Loading branch information
patman15 committed Dec 31, 2024
1 parent 6f09c83 commit 301b121
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
8 changes: 3 additions & 5 deletions custom_components/bms_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@
},
{
"local_name": "$PFLAC*",
"service_uuid": "0000ffe0-0000-1000-8000-00805f9b34fb",
"manufacturer_id": 65535
"service_uuid": "0000ffe0-0000-1000-8000-00805f9b34fb"
},
{
"local_name": "NWJ20*",
"service_uuid": "0000ffe0-0000-1000-8000-00805f9b34fb",
"manufacturer_id": 65535
"service_uuid": "0000ffe0-0000-1000-8000-00805f9b34fb"
},
{
"manufacturer_id": 54976
Expand All @@ -98,5 +96,5 @@
"issue_tracker": "https://github.com/patman15/BMS_BLE-HA/issues",
"loggers": ["bleak_retry_connector"],
"requirements": [],
"version": "1.11.3"
"version": "1.11.4"
}
1 change: 0 additions & 1 deletion custom_components/bms_ble/plugins/ective_bms.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def matcher_dict_list() -> list[dict[str, Any]]:
{
"local_name": pattern,
"service_uuid": BMS.uuid_services()[0],
"manufacturer_id": 65535,
"connectable": True,
} for pattern in ["$PFLAC*", "NWJ20*"]
]
Expand Down
17 changes: 17 additions & 0 deletions tests/advertisement_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@
),
"ective_bms",
),
( # nRF Connect (https://github.com/patman15/BMS_BLE-HA/issues/82#issuecomment-2498299433)
generate_advertisement_data(
local_name="$PFLAC,R,RADIOID\x0D\x0A",
manufacturer_data={65535: b"\x10\x55\x44\x33\xE8\xB4"},
service_uuids=["0000ffe0-0000-1000-8000-00805f9b34fb"],
rssi=-47,
),
"ective_bms",
),
( # bluetoothctl (https://github.com/patman15/BMS_BLE-HA/issues/137)
generate_advertisement_data(
local_name="NWJ20200720020539",
manufacturer_data={0: b"\x34\x14\xb5\x9d\x78\xE7\x4c"},
service_uuids=["0000ffe0-0000-1000-8000-00805f9b34fb"],
),
"ective_bms",
),
(
generate_advertisement_data(
local_name="BatteryOben-00",
Expand Down
6 changes: 5 additions & 1 deletion tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ async def test_bluetooth_discovery(
inject_bluetooth_service_info_bleak(hass, advertisement)
await hass.async_block_till_done(wait_background_tasks=True)

result: ConfigFlowResult = hass.config_entries.flow.async_progress_by_handler(DOMAIN)[0]
flowresults: list[ConfigFlowResult] = (
hass.config_entries.flow.async_progress_by_handler(DOMAIN)
)
assert len(flowresults) == 1, f"Expected one flow result for {advertisement}"
result: ConfigFlowResult = flowresults[0]
assert result.get("step_id") == "bluetooth_confirm"
assert result.get("context", {}).get("unique_id") == advertisement.address

Expand Down

0 comments on commit 301b121

Please sign in to comment.