Skip to content

Commit 2d6e3ed

Browse files
authored
summarized OGT bms pattern (#111)
1 parent 776c00c commit 2d6e3ed

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

custom_components/bms_ble/manifest.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"name": "BLE Battery Management",
44
"bluetooth": [
55
{
6-
"local_name": "SmartBat-A*",
7-
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb"
8-
},
9-
{
10-
"local_name": "SmartBat-B*",
6+
"local_name": "SmartBat-[AB]*",
117
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb"
128
},
139
{

custom_components/bms_ble/plugins/ogt_bms.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,10 @@ def matcher_dict_list() -> list[dict[str, Any]]:
9797
"""Return a list of Bluetooth matchers."""
9898
return [
9999
{
100-
"local_name": "SmartBat-A*",
100+
"local_name": "SmartBat-[AB]*",
101101
"service_uuid": BMS.uuid_services()[0],
102102
"connectable": True,
103-
},
104-
{
105-
"local_name": "SmartBat-B*",
106-
"service_uuid": BMS.uuid_services()[0],
107-
"connectable": True,
108-
},
103+
}
109104
]
110105

111106
@staticmethod
@@ -140,9 +135,7 @@ async def _async_update(self) -> BMSsample:
140135
try:
141136
await asyncio.wait_for(self._wait_event(), timeout=BAT_TIMEOUT)
142137
except TimeoutError:
143-
LOGGER.debug(
144-
"Reading %s timed out", self._REGISTERS[key][BMS.IDX_NAME]
145-
)
138+
LOGGER.debug("Reading %s timed out", self._REGISTERS[key][BMS.IDX_NAME])
146139
if key > 48 and f"{KEY_CELL_VOLTAGE}{64-key}" not in self._values:
147140
break
148141

0 commit comments

Comments
 (0)