mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Round temp and percentage for octoprint sensors (#2128)
This commit is contained in:
parent
49882255c4
commit
ca3da0e53e
@ -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…
x
Reference in New Issue
Block a user