Fix climate hold bug in ecobee (#46613)

This commit is contained in:
Mark Coombes 2021-02-16 12:06:20 -05:00 committed by GitHub
parent 08201d146b
commit 960b5b7d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 12 deletions

View File

@ -559,7 +559,7 @@ class Thermostat(ClimateEntity):
if preset_mode == PRESET_AWAY:
self.data.ecobee.set_climate_hold(
self.thermostat_index, "away", "indefinite"
self.thermostat_index, "away", "indefinite", self.hold_hours()
)
elif preset_mode == PRESET_TEMPERATURE:
@ -570,6 +570,7 @@ class Thermostat(ClimateEntity):
self.thermostat_index,
PRESET_TO_ECOBEE_HOLD[preset_mode],
self.hold_preference(),
self.hold_hours(),
)
elif preset_mode == PRESET_NONE:
@ -585,14 +586,20 @@ class Thermostat(ClimateEntity):
if climate_ref is not None:
self.data.ecobee.set_climate_hold(
self.thermostat_index, climate_ref, self.hold_preference()
self.thermostat_index,
climate_ref,
self.hold_preference(),
self.hold_hours(),
)
else:
_LOGGER.warning("Received unknown preset mode: %s", preset_mode)
else:
self.data.ecobee.set_climate_hold(
self.thermostat_index, preset_mode, self.hold_preference()
self.thermostat_index,
preset_mode,
self.hold_preference(),
self.hold_hours(),
)
@property
@ -743,7 +750,7 @@ class Thermostat(ClimateEntity):
"useEndTime2hour": 2,
"useEndTime4hour": 4,
}
return hold_hours_map.get(device_preference, 0)
return hold_hours_map.get(device_preference)
def create_vacation(self, service_data):
"""Create a vacation with user-specified parameters."""

View File

@ -3,6 +3,6 @@
"name": "ecobee",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ecobee",
"requirements": ["python-ecobee-api==0.2.8"],
"requirements": ["python-ecobee-api==0.2.10"],
"codeowners": ["@marthoc"]
}

View File

@ -1747,7 +1747,7 @@ python-clementine-remote==1.0.1
python-digitalocean==1.13.2
# homeassistant.components.ecobee
python-ecobee-api==0.2.8
python-ecobee-api==0.2.10
# homeassistant.components.eq3btsmart
# python-eq3bt==0.1.11

View File

@ -914,7 +914,7 @@ pysqueezebox==0.5.5
pysyncthru==0.7.0
# homeassistant.components.ecobee
python-ecobee-api==0.2.8
python-ecobee-api==0.2.10
# homeassistant.components.darksky
python-forecastio==1.4.0

View File

@ -209,14 +209,14 @@ async def test_set_temperature(ecobee_fixture, thermostat, data):
data.reset_mock()
thermostat.set_temperature(target_temp_low=20, target_temp_high=30)
data.ecobee.set_hold_temp.assert_has_calls(
[mock.call(1, 30, 20, "nextTransition", 0)]
[mock.call(1, 30, 20, "nextTransition", None)]
)
# Auto -> Hold
data.reset_mock()
thermostat.set_temperature(temperature=20)
data.ecobee.set_hold_temp.assert_has_calls(
[mock.call(1, 25, 15, "nextTransition", 0)]
[mock.call(1, 25, 15, "nextTransition", None)]
)
# Cool -> Hold
@ -224,7 +224,7 @@ async def test_set_temperature(ecobee_fixture, thermostat, data):
ecobee_fixture["settings"]["hvacMode"] = "cool"
thermostat.set_temperature(temperature=20.5)
data.ecobee.set_hold_temp.assert_has_calls(
[mock.call(1, 20.5, 20.5, "nextTransition", 0)]
[mock.call(1, 20.5, 20.5, "nextTransition", None)]
)
# Heat -> Hold
@ -232,7 +232,7 @@ async def test_set_temperature(ecobee_fixture, thermostat, data):
ecobee_fixture["settings"]["hvacMode"] = "heat"
thermostat.set_temperature(temperature=20)
data.ecobee.set_hold_temp.assert_has_calls(
[mock.call(1, 20, 20, "nextTransition", 0)]
[mock.call(1, 20, 20, "nextTransition", None)]
)
# Heat -> Auto
@ -311,7 +311,7 @@ def test_hold_hours(ecobee_fixture, thermostat):
"askMe",
]:
ecobee_fixture["settings"]["holdAction"] = action
assert thermostat.hold_hours() == 0
assert thermostat.hold_hours() is None
async def test_set_fan_mode_on(thermostat, data):