Round temp and percentage for octoprint sensors (#2128)

This commit is contained in:
William Scanlon authored and Paulus Schoutsen committed 2016-05-25 09:10:59 -07:00
1 parent 49882255c4
commit ca3da0e53e
1 file changed
+5 -1
+5 -1
View File
@@ -93,7 +93,11 @@ class OctoPrintSensor(Entity):
@property
def state(self):
"""Return the state of the sensor."""
return self._state
sensor_unit = self.unit_of_measurement
if sensor_unit == TEMP_CELSIUS or sensor_unit == "%":
return round(self._state, 2)
else:
return self._state
@property
def unit_of_measurement(self):