Round temp and percentage for octoprint sensors (#2128)

This commit is contained in:
William Scanlon 2016-05-25 12:10:59 -04:00 committed by Paulus Schoutsen
parent 49882255c4
commit ca3da0e53e

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):