Skip to content

Commit

Permalink
removed specific naming
Browse files Browse the repository at this point in the history
  • Loading branch information
patman15 committed Dec 6, 2024
1 parent 1efd4dc commit b81b04f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion custom_components/bms_ble/plugins/basebms.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
disconnected_callback=self._on_disconnect,
services=[*self.uuid_services()],
)
self.name: str = self._ble_device.name or "undefined"
self.name: Final[str] = self._ble_device.name or "undefined"
self._data_event: Final[asyncio.Event] = asyncio.Event()

@staticmethod
Expand Down
1 change: 0 additions & 1 deletion custom_components/bms_ble/plugins/jbd_bms.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class BMS(BaseBMS):
def __init__(self, ble_device: BLEDevice, reconnect: bool = False) -> None:
"""Intialize private BMS members."""
super().__init__(LOGGER, self._notification_handler, ble_device, reconnect)
self.name: str = str(self._ble_device.name) + self._ble_device.address[-4:]
self._data: bytearray = bytearray()
self._data_final: bytearray = bytearray()

Expand Down
28 changes: 0 additions & 28 deletions tests/test_jbd_bms.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,34 +63,6 @@ async def write_gatt_char(
self._notify_callback("MockJBDBleakClient", notify_data)


# class MockInvalidBleakClient(MockJBDBleakClient):
# """Emulate a JBD BMS BleakClient returning wrong data."""

# def _response(
# self, char_specifier: BleakGATTCharacteristic | int | str | UUID, data: Buffer
# ) -> bytearray:
# if (
# isinstance(char_specifier, str)
# and normalize_uuid_str(char_specifier) == normalize_uuid_str("ff02")
# and bytearray(data)[0] == self.HEAD_CMD
# ):
# if bytearray(data)[1:3] == self.CMD_INFO:
# return bytearray( # wrong end
# b"\xdd\x03\x00\x1D\x06\x18\xFE\xE1\x01\xF2\x01\xF4\x00\x2A\x2C\x7C\x00\x00\x00"
# b"\x00\x00\x00\x80\x64\x03\x04\x03\x0B\x8B\x0B\x8A\x0B\x84\xf8\x84\xdd"
# )

# return ( # wrong CRC
# bytearray(b"\xdd\x04\x00\x1d") + bytearray(31) + bytearray(b"\x77")
# )

# return bytearray()

# async def disconnect(self) -> bool:
# """Mock disconnect to raise BleakError."""
# raise BleakError


class MockOversizedBleakClient(MockJBDBleakClient):
"""Emulate a JBD BMS BleakClient returning wrong data length."""

Expand Down

0 comments on commit b81b04f

Please sign in to comment.