Remove redundant str cast - sensor value conversion (#55204)

pull/55215/head
Marc Mueller 2021-08-25 15:01:17 +02:00 committed by GitHub
parent d4064e7044
commit 1224d68d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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