Skip to content

Commit 8580569

Browse files
committed
add battery level to Thermopro
1 parent 708297c commit 8580569

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

custom_components/ble_monitor/ble_parser/thermopro.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@ def parse_thermopro(self, data: bytes, device_type, mac: bytes):
1111
"""Thermopro parser"""
1212
if device_type in ["TP357", "TP359"]:
1313
firmware = "Thermopro"
14-
xvalue = data[3:6]
15-
(temp, humi) = unpack("<hB", xvalue)
14+
xvalue = data[3:7]
15+
(temp, humi, batt) = unpack("<hBB", xvalue)
16+
if batt == 2:
17+
# full battery
18+
batt_low = 0
19+
else:
20+
# low battery
21+
batt_low = 1
1622
result = {
1723
"temperature": temp / 10,
1824
"humidity": humi,
25+
"battery low": batt_low
1926
}
2027
else:
21-
device_type = None
22-
if device_type is None:
2328
if self.report_unknown == "Thermopro":
2429
_LOGGER.info(
2530
"BLE ADV from UNKNOWN Thermopro DEVICE: MAC: %s, ADV: %s",

custom_components/ble_monitor/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"btsocket>=0.3.0",
1515
"pyric>=0.1.6.3"
1616
],
17-
"version": "13.0.2"
17+
"version": "13.0.3"
1818
}

0 commit comments

Comments
 (0)