Skip to content

Commit b286a37

Browse files
authored
feat: add support for Tilt Pro sensors (#44)
* feat: add tilt pro scaling * fix: spelling
1 parent b7d245f commit b286a37

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/tilt_ble/parser.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,17 @@ def _start_update(self, service_info: BluetoothServiceInfo) -> None:
6161
if not changed_manufacturer_data:
6262
return
6363

64-
temperature = major
65-
specific_gravity = minor / 1000
64+
tilt_pro = minor >= 5000
65+
66+
# up the scale rate if a tilt pro
67+
temp_scalar = 10 if tilt_pro else 1
68+
grav_scalar = 10000 if tilt_pro else 1000
69+
70+
temperature = major / temp_scalar
71+
specific_gravity = minor / grav_scalar
6672

6773
_LOGGER.debug(
68-
"Tilt %s data: temp=%.2f, gravity=%.2f, power=%.2f",
74+
"Tilt %s data: temp=%.3f, gravity=%.3f, power=%.2f",
6975
color,
7076
temperature,
7177
specific_gravity,

0 commit comments

Comments
 (0)