Skip to content

Commit 2d27616

Browse files
committed
Fix unit of measurement for resolution, adapt format_measure()
1 parent e5b2b9c commit 2d27616

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

plugwise/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@
437437
# Added measurements from actuator_functionalities/thermostat_functionality
438438
"lower_bound": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
439439
"upper_bound": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
440-
"resolution": {ATTR_UNIT_OF_MEASUREMENT: None},
440+
"resolution": {ATTR_UNIT_OF_MEASUREMENT: TEMP_KELVIN},
441441
}
442442

443443
# Heater Central related measurements

plugwise/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
PERCENTAGE,
2020
PLUGWISE_EPOCH,
2121
TEMP_CELSIUS,
22+
TEMP_KELVIN,
2223
UTF8_DECODE,
2324
VOLUME_CUBIC_METERS,
2425
)
@@ -99,7 +100,7 @@ def format_measure(measure: str, unit: str) -> float | int | bool:
99100
"""Format measure to correct type."""
100101
try:
101102
measure = int(measure)
102-
if unit == TEMP_CELSIUS:
103+
if unit in [TEMP_CELSIUS, TEMP_KELVIN]:
103104
measure = float(measure)
104105
except ValueError:
105106
if unit == PERCENTAGE:

0 commit comments

Comments
 (0)