If decimal_places is 0, cast to int after rounding

This commit is contained in:
Philip Lundrigan committed 2015-12-09 15:16:42 -07:00
1 parent d84bea3621
commit 3938b9f3f6
3 files changed
+6

No files matched your search

+2
View File
@@ -140,6 +140,8 @@ class RestSensor(Entity):
value = float(value) * float(self._corr_factor)
if self._decimal_places is not None:
value = round(value, self._decimal_places)
if self._decimal_places == 0:
value = int(value)
self._state = value
except ValueError:
self._state = RestSensor.extract_value(value, self._variable)