Skip to content

Commit

Permalink
fix: linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernst79 committed Aug 17, 2022
1 parent d47bfc9 commit b1dc181
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bthome_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def parse_int(data_obj: bytes, factor: float = 1) -> float:
int.from_bytes(data_obj, "little", signed=True) * factor, decimal_places
)


def parse_float(data_obj: bytes, factor: float = 1) -> float | None:
"""convert bytes (as float) and factor to float"""
decimal_places = -int(f"{factor:e}".split("e")[-1])
Expand Down Expand Up @@ -196,7 +197,7 @@ def _parse_bthome(
if obj_data_length != 0:
if obj_data_format <= 3:
if obj_meas_type in DATA_MEAS_DICT:
meas_data = payload[payload_start + 2 : next_start]
meas_data = payload[payload_start + 2:next_start]
meas_type = DATA_MEAS_DICT[obj_meas_type][0]
meas_factor = DATA_MEAS_DICT[obj_meas_type][1]
if obj_data_format == 3:
Expand All @@ -214,12 +215,13 @@ def _parse_bthome(
elif obj_data_format == 4:
# Using a different MAC address than the source mac address
# is not supported yet
data_mac = parse_mac(payload[payload_start + 1 : next_start])
data_mac = parse_mac(payload[payload_start + 1:next_start])
if data_mac:
bthome_ble_mac = data_mac # noqa: F841
else:
_LOGGER.error(
"UNKNOWN dataobject in BThome BLE payload! Adv: %s", data.hex(),
"UNKNOWN dataobject in BThome BLE payload! Adv: %s",
data.hex(),
)
payload_start = next_start

Expand Down

0 comments on commit b1dc181

Please sign in to comment.