Align temperature conversion with other converters (#79521)

* Align temperature conversion with other converters

* Add comments and docstring

* Align tests
This commit is contained in:
epenet 2022-10-03 10:09:55 +02:00 committed by GitHub
parent 47b40e1e61
commit 825f9502ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 63 deletions

View file

@ -819,7 +819,9 @@ def temperature_from_object(hass, temp_obj, interval=False):
# convert to Celsius if absolute temperature
temp -= 273.15
return TemperatureConverter.convert(temp, from_unit, to_unit, interval=interval)
if interval:
return TemperatureConverter.convert_interval(temp, from_unit, to_unit)
return TemperatureConverter.convert(temp, from_unit, to_unit)
@HANDLERS.register(("Alexa.ThermostatController", "SetTargetTemperature"))