Improve isy994 sensor typing (#137077)

pull/136498/head^2
Marc Mueller 2025-02-01 16:48:09 +01:00 committed by GitHub
parent 278c35f830
commit 1157a08f72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -198,14 +198,13 @@ class ISYSensorEntity(ISYNodeEntity, SensorEntity):
# Handle ISY precision and rounding
value = convert_isy_value_to_hass(value, uom, self.target.prec)
if value is None:
return None
# Convert temperatures to Home Assistant's unit
if uom in (UnitOfTemperature.CELSIUS, UnitOfTemperature.FAHRENHEIT):
value = self.hass.config.units.temperature(value, uom)
if value is None:
return None
assert isinstance(value, (int, float))
return value