Skip to content

Commit bd85141

Browse files
committed
Valve percentage has now a range on 0-100
1 parent 8a7579b commit bd85141

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎plugwise/util.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,11 @@ def escape_illegal_xml_characters(xmldata: str) -> str:
199199
def format_measure(measure: str, unit: str) -> float | int:
200200
"""Format measure to correct type."""
201201
float_measure = float(measure)
202-
if unit == PERCENTAGE and 0 < float_measure <= 1:
203-
return int(float_measure * 100)
202+
if unit == PERCENTAGE:
203+
if 0 < float_measure <= 1: # support older firmare
204+
return int(float_measure * 100)
205+
206+
return int(float_measure)
204207

205208
if unit == ENERGY_KILO_WATT_HOUR:
206209
float_measure = float_measure / 1000

0 commit comments

Comments
 (0)