-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed redundant config_flow for device discovery * add detection tests for all BMS types * check for MAC addr if name is empty
- Loading branch information
Showing
4 changed files
with
136 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ bluetooth-data-tools | |
pyserial-asyncio | ||
pyudev | ||
pytest-homeassistant-custom-component==0.13.132 | ||
|
||
kegtron-ble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
"""Test the BLE Battery Management System base class functions.""" | ||
|
||
from custom_components.bms_ble.const import BMS_TYPES | ||
from custom_components.bms_ble.plugins.basebms import BaseBMS | ||
|
||
from .advertisement_data import ADVERTISEMENTS | ||
|
||
def test_device_info(plugin_fixture) -> None: | ||
|
||
def test_device_info(plugin_fixture: BaseBMS) -> None: | ||
"""Test that the BMS returns valid device information.""" | ||
bms_instance: BaseBMS = plugin_fixture | ||
result = bms_instance.device_info() | ||
assert "manufacturer" in result | ||
assert "model" in result | ||
|
||
|
||
def test_matcher_dict(plugin_fixture) -> None: | ||
def test_matcher_dict(plugin_fixture: BaseBMS) -> None: | ||
"""Test that the BMS returns BT matcher.""" | ||
bms_instance: BaseBMS = plugin_fixture | ||
assert len(bms_instance.matcher_dict_list()) | ||
|
||
def test_advertisements_complete() -> None: | ||
"""Check that each BMS has at least one advertisement.""" | ||
bms_unchecked: list[str] = BMS_TYPES | ||
for _adv, bms in ADVERTISEMENTS: | ||
if bms in bms_unchecked: | ||
bms_unchecked.remove(bms) | ||
assert not bms_unchecked, f"{len(bms_unchecked)} missing BMS type advertisements: {bms_unchecked}" |