mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Google assistant fix target temp for *F values. (#19083)
* home-assistant/home-assistant#18524 : Add rounding to *F temps * home-assistant/home-assistant#18524 : Linting * simplify round behavior * fix trailing whitespace (thanks github editor)
This commit is contained in:
parent
da338f2c1a
commit
df2f476c67
@ -588,8 +588,11 @@ class TemperatureSettingTrait(_Trait):
|
|||||||
max_temp = self.state.attributes[climate.ATTR_MAX_TEMP]
|
max_temp = self.state.attributes[climate.ATTR_MAX_TEMP]
|
||||||
|
|
||||||
if command == COMMAND_THERMOSTAT_TEMPERATURE_SETPOINT:
|
if command == COMMAND_THERMOSTAT_TEMPERATURE_SETPOINT:
|
||||||
temp = temp_util.convert(params['thermostatTemperatureSetpoint'],
|
temp = temp_util.convert(
|
||||||
TEMP_CELSIUS, unit)
|
params['thermostatTemperatureSetpoint'], TEMP_CELSIUS,
|
||||||
|
unit)
|
||||||
|
if unit == TEMP_FAHRENHEIT:
|
||||||
|
temp = round(temp)
|
||||||
|
|
||||||
if temp < min_temp or temp > max_temp:
|
if temp < min_temp or temp > max_temp:
|
||||||
raise SmartHomeError(
|
raise SmartHomeError(
|
||||||
@ -607,6 +610,8 @@ class TemperatureSettingTrait(_Trait):
|
|||||||
temp_high = temp_util.convert(
|
temp_high = temp_util.convert(
|
||||||
params['thermostatTemperatureSetpointHigh'], TEMP_CELSIUS,
|
params['thermostatTemperatureSetpointHigh'], TEMP_CELSIUS,
|
||||||
unit)
|
unit)
|
||||||
|
if unit == TEMP_FAHRENHEIT:
|
||||||
|
temp_high = round(temp_high)
|
||||||
|
|
||||||
if temp_high < min_temp or temp_high > max_temp:
|
if temp_high < min_temp or temp_high > max_temp:
|
||||||
raise SmartHomeError(
|
raise SmartHomeError(
|
||||||
@ -615,7 +620,10 @@ class TemperatureSettingTrait(_Trait):
|
|||||||
"{} and {}".format(min_temp, max_temp))
|
"{} and {}".format(min_temp, max_temp))
|
||||||
|
|
||||||
temp_low = temp_util.convert(
|
temp_low = temp_util.convert(
|
||||||
params['thermostatTemperatureSetpointLow'], TEMP_CELSIUS, unit)
|
params['thermostatTemperatureSetpointLow'], TEMP_CELSIUS,
|
||||||
|
unit)
|
||||||
|
if unit == TEMP_FAHRENHEIT:
|
||||||
|
temp_low = round(temp_low)
|
||||||
|
|
||||||
if temp_low < min_temp or temp_low > max_temp:
|
if temp_low < min_temp or temp_low > max_temp:
|
||||||
raise SmartHomeError(
|
raise SmartHomeError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user