mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +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
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""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
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user