Skip to content

Commit 9c82494

Browse files
committed
format_measure: add check for max
Needed to handle the new humidity value (jip)
1 parent 3e2c560 commit 9c82494

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugwise/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ def format_measure(measure, unit):
9797
try:
9898
measure = int(measure)
9999
except ValueError:
100-
if unit == PERCENTAGE and float(measure) > 0:
101-
return int(float(measure) * 100)
100+
if unit == PERCENTAGE:
101+
if 0 < float(measure) <= 1:
102+
return int(float(measure) * 100)
102103

103104
if unit == ENERGY_KILO_WATT_HOUR:
104105
measure = float(measure) / 1000

0 commit comments

Comments
 (0)