mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Catch unexpected response in Honeywell (#103169)
catch unexpected response
This commit is contained in:
parent
cef68ea33c
commit
4a93465e85
@ -353,6 +353,11 @@ class HoneywellUSThermostat(ClimateEntity):
|
||||
if mode == "heat":
|
||||
await self._device.set_setpoint_heat(temperature)
|
||||
|
||||
except UnexpectedResponse as err:
|
||||
raise HomeAssistantError(
|
||||
"Honeywell set temperature failed: Invalid Response"
|
||||
) from err
|
||||
|
||||
except SomeComfortError as err:
|
||||
_LOGGER.error("Invalid temperature %.1f: %s", temperature, err)
|
||||
raise ValueError(
|
||||
@ -369,6 +374,11 @@ class HoneywellUSThermostat(ClimateEntity):
|
||||
if temperature := kwargs.get(ATTR_TARGET_TEMP_LOW):
|
||||
await self._device.set_setpoint_heat(temperature)
|
||||
|
||||
except UnexpectedResponse as err:
|
||||
raise HomeAssistantError(
|
||||
"Honeywell set temperature failed: Invalid Response"
|
||||
) from err
|
||||
|
||||
except SomeComfortError as err:
|
||||
_LOGGER.error("Invalid temperature %.1f: %s", temperature, err)
|
||||
raise ValueError(
|
||||
|
@ -358,7 +358,24 @@ async def test_service_calls_off_mode(
|
||||
device.set_setpoint_heat.assert_called_with(77)
|
||||
assert "Invalid temperature" in caplog.text
|
||||
|
||||
device.set_setpoint_heat.reset_mock()
|
||||
device.set_setpoint_heat.side_effect = aiosomecomfort.UnexpectedResponse
|
||||
caplog.clear()
|
||||
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
ATTR_ENTITY_ID: entity_id,
|
||||
ATTR_TARGET_TEMP_LOW: 25.0,
|
||||
ATTR_TARGET_TEMP_HIGH: 35.0,
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_setpoint_cool.assert_called_with(95)
|
||||
device.set_setpoint_heat.assert_called_with(77)
|
||||
|
||||
reset_mock(device)
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
@ -702,6 +719,17 @@ async def test_service_calls_heat_mode(
|
||||
device.set_hold_heat.reset_mock()
|
||||
assert "Invalid temperature" in caplog.text
|
||||
|
||||
device.set_hold_heat.side_effect = aiosomecomfort.UnexpectedResponse
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{ATTR_ENTITY_ID: entity_id, ATTR_TEMPERATURE: 15},
|
||||
blocking=True,
|
||||
)
|
||||
device.set_hold_heat.assert_called_once_with(datetime.time(2, 30), 59)
|
||||
device.set_hold_heat.reset_mock()
|
||||
|
||||
caplog.clear()
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
Loading…
x
Reference in New Issue
Block a user