Skip to content

Commit

Permalink
fix: use bluetooth_data_tools for short_address (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Aug 25, 2022
1 parent 36c0c20 commit dfe24bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 13 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sphinx-rtd-theme = {version = "^1.0", optional = true}
myst-parser = {version = "^0.18", optional = true}
bluetooth-sensor-state-data = ">=1.6.0"
sensor-state-data = ">=2.3.1"
bluetooth-data-tools = ">=0.1.2"

[tool.poetry.extras]
docs = [
Expand Down
9 changes: 1 addition & 8 deletions src/thermopro_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,17 @@
import logging
from struct import Struct

from bluetooth_data_tools import short_address
from bluetooth_sensor_state_data import BluetoothData
from home_assistant_bluetooth import BluetoothServiceInfo
from sensor_state_data import SensorLibrary

# from bluetooth_data_tools import short_address

_LOGGER = logging.getLogger(__name__)


UNPACK = Struct("<hB").unpack


def short_address(address: str) -> str:
"""Convert a Bluetooth address to a short address."""
split_address = address.replace("-", ":").split(":")
return f"{split_address[-2].upper()}{split_address[-1].upper()}"[-4:]


class ThermoProBluetoothDeviceData(BluetoothData):
"""Date update for ThermoPro Bluetooth devices."""

Expand Down

0 comments on commit dfe24bb

Please sign in to comment.