mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Remove redundant str cast - sensor value conversion (#55204)
This commit is contained in:
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…
x
Reference in New Issue
Block a user