Skip to content

Commit ef52e08

Browse files
committed
Use float()
1 parent 79bb8e0 commit ef52e08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugwise/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ def escape_illegal_xml_characters(xmldata):
7373

7474
def format_measure(measure, unit):
7575
"""Format measure to correct type."""
76-
if unit == PERCENTAGE and measure > 0:
77-
measure = int(measure * 100)
76+
if unit == PERCENTAGE and float(measure) > 0:
77+
measure = int(float(measure) * 100)
7878
if unit == ENERGY_KILO_WATT_HOUR:
79-
measure = measure / 1000
79+
measure = float(measure) / 1000
8080
try:
8181
measure = int(measure)
8282
except ValueError:

0 commit comments

Comments
 (0)