From ca3da0e53e74b9cf0a67c0d51d070d863f757424 Mon Sep 17 00:00:00 2001 From: William Scanlon Date: Wed, 25 May 2016 12:10:59 -0400 Subject: [PATCH] Round temp and percentage for octoprint sensors (#2128) --- homeassistant/components/sensor/octoprint.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/octoprint.py b/homeassistant/components/sensor/octoprint.py index bb4e6973df8..4bf543f3831 100644 --- a/homeassistant/components/sensor/octoprint.py +++ b/homeassistant/components/sensor/octoprint.py @@ -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):