Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:

repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.11.2
rev: v4.12.1
hooks:
- id: commitizen
stages: [commit-msg]
Expand Down Expand Up @@ -41,7 +41,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
Expand Down
14 changes: 7 additions & 7 deletions src/xiaomi_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def obj1001(
if len(xobj) != 3:
return {}

(button_type, value, press_type) = BUTTON_STRUCT(xobj)
button_type, value, press_type = BUTTON_STRUCT(xobj)

# button_type represents the pressed button or rubiks cube rotation direction
remote_command = None
Expand Down Expand Up @@ -920,7 +920,7 @@ def obj100d(
) -> dict[str, Any]:
"""Temperature and humidity"""
if len(xobj) == 4:
(temp, humi) = TH_STRUCT(xobj)
temp, humi = TH_STRUCT(xobj)
device.update_predefined_sensor(SensorLibrary.TEMPERATURE__CELSIUS, temp / 10)
device.update_predefined_sensor(SensorLibrary.HUMIDITY__PERCENTAGE, humi / 10)
return {}
Expand Down Expand Up @@ -962,7 +962,7 @@ def obj2000(
) -> dict[str, Any]:
"""Body temperature"""
if len(xobj) == 5:
(temp1, temp2, bat) = TTB_STRUCT(xobj)
temp1, temp2, bat = TTB_STRUCT(xobj)
# Body temperature is calculated from the two measured temperatures.
# Formula is based on approximation based on values in the app in
# the range 36.5 - 37.8.
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def obj4e16(
if len(xobj) != 9:
return {}

(profile_id, data, timestamp) = struct.unpack("<BII", xobj)
profile_id, data, timestamp = struct.unpack("<BII", xobj)
if data == 0:
return {}

Expand All @@ -1654,7 +1654,7 @@ def obj6e16(
xobj: bytes, device: XiaomiBluetoothDeviceData, device_type: str
) -> dict[str, Any]:
"""Body Composition Scale S400"""
(profile_id, data, _) = struct.unpack("<BII", xobj)
profile_id, data, _ = struct.unpack("<BII", xobj)
if not data:
return {}
mass = data & 0x7FF
Expand Down Expand Up @@ -1866,7 +1866,7 @@ def _parse_hhcc(self, service_info: BluetoothServiceInfo, data: bytes) -> bool:
self.set_device_manufacturer("HHCC Plant Technology Co. Ltd")

xvalue_1 = data[0:3]
(moist, temp) = struct.unpack(">BH", xvalue_1)
moist, temp = struct.unpack(">BH", xvalue_1)
self.update_predefined_sensor(SensorLibrary.TEMPERATURE__CELSIUS, temp / 10)
self.update_predefined_sensor(SensorLibrary.MOISTURE__PERCENTAGE, moist)

Expand All @@ -1875,7 +1875,7 @@ def _parse_hhcc(self, service_info: BluetoothServiceInfo, data: bytes) -> bool:
self.update_predefined_sensor(SensorLibrary.LIGHT__LIGHT_LUX, illu)

xvalue_3 = data[6:9]
(batt, cond) = struct.unpack(">BH", xvalue_3)
batt, cond = struct.unpack(">BH", xvalue_3)
self.update_predefined_sensor(SensorLibrary.BATTERY__PERCENTAGE, batt)
self.update_predefined_sensor(SensorLibrary.CONDUCTIVITY__CONDUCTIVITY, cond)

Expand Down