Remove redundant str cast - sensor value conversion (#55204)
This commit is contained in:
parent
d4064e7044
commit
1224d68d05
2 changed files with 2 additions and 2 deletions
|
@ -291,7 +291,7 @@ class SensorEntity(Entity):
|
||||||
# Suppress ValueError (Could not convert sensor_value to float)
|
# Suppress ValueError (Could not convert sensor_value to float)
|
||||||
with suppress(ValueError):
|
with suppress(ValueError):
|
||||||
temp = units.temperature(float(value), unit_of_measurement)
|
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
|
return value
|
||||||
|
|
||||||
|
|
|
@ -122,4 +122,4 @@ async def test_temperature_sensor_f(mock_function, hass):
|
||||||
sensor.hass = hass
|
sensor.hass = hass
|
||||||
sensor.update()
|
sensor.update()
|
||||||
|
|
||||||
assert sensor.state == "75"
|
assert sensor.state == 75
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue