Round temp and percentage for octoprint sensors (#2128)
This commit is contained in:
parent
49882255c4
commit
ca3da0e53e
1 changed files with 5 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue