From 69dee168a10f7aaf6640d07f37fd56655deefc2c Mon Sep 17 00:00:00 2001 From: aufano Date: Fri, 7 Apr 2017 02:40:59 +0200 Subject: [PATCH] Fix current_temperature is rounded (#6960) * Fix current_temperature is rounded * fix Unnecessary parens after 'if' --- homeassistant/components/climate/__init__.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index bd2e38433d6ba..2a0bd2eb5c19f 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -692,18 +692,16 @@ def max_humidity(self): def _convert_for_display(self, temp): """Convert temperature into preferred units for display purposes.""" - if (temp is None or not isinstance(temp, Number) or - self.temperature_unit == self.unit_of_measurement): + if temp is None or not isinstance(temp, Number): return temp - - value = convert_temperature(temp, self.temperature_unit, - self.unit_of_measurement) - + if self.temperature_unit != self.unit_of_measurement: + temp = convert_temperature(temp, self.temperature_unit, + self.unit_of_measurement) # Round in the units appropriate if self.precision == PRECISION_HALVES: - return round(value * 2) / 2.0 + return round(temp * 2) / 2.0 elif self.precision == PRECISION_TENTHS: - return round(value, 1) + return round(temp, 1) else: # PRECISION_WHOLE as a fall back - return round(value) + return round(temp)