Remove redundant str cast - sensor value conversion (#55204)
parent
d4064e7044
commit
1224d68d05
|
@ -291,7 +291,7 @@ class SensorEntity(Entity):
|
|||
# Suppress ValueError (Could not convert sensor_value to float)
|
||||
with suppress(ValueError):
|
||||
temp = units.temperature(float(value), unit_of_measurement)
|
||||
value = str(round(temp) if prec == 0 else round(temp, prec))
|
||||
value = round(temp) if prec == 0 else round(temp, prec)
|
||||
|
||||
return value
|
||||
|
||||
|
|
|
@ -122,4 +122,4 @@ async def test_temperature_sensor_f(mock_function, hass):
|
|||
sensor.hass = hass
|
||||
sensor.update()
|
||||
|
||||
assert sensor.state == "75"
|
||||
assert sensor.state == 75
|
||||
|
|
Loading…
Reference in New Issue