mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 08:06:00 +01:00
Handle cpd_enabled error in Tessie (#155322)
This commit is contained in:
@@ -21,6 +21,7 @@ TRANSLATED_ERRORS = {
|
||||
"already inactive": "already_inactive",
|
||||
"incorrect pin": "incorrect_pin",
|
||||
"no cable": "no_cable",
|
||||
"cpd_enabled": "cpd_enabled",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -517,6 +517,9 @@
|
||||
"command_failed": {
|
||||
"message": "Command failed, {message}"
|
||||
},
|
||||
"cpd_enabled": {
|
||||
"message": "Child presence detection has blocked the command, remove weight from seats."
|
||||
},
|
||||
"incorrect_pin": {
|
||||
"message": "Incorrect PIN for {name}."
|
||||
},
|
||||
|
||||
@@ -130,3 +130,21 @@ async def test_errors(hass: HomeAssistant) -> None:
|
||||
)
|
||||
mock_set.assert_called_once()
|
||||
assert error.value.__cause__ == ERROR_UNKNOWN
|
||||
|
||||
# Test setting climate with child presence detection error
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.tessie.climate.start_climate_preconditioning",
|
||||
return_value={"result": False, "reason": "cpd_enabled"},
|
||||
) as mock_set,
|
||||
pytest.raises(HomeAssistantError) as error,
|
||||
):
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
)
|
||||
mock_set.assert_called_once()
|
||||
assert error.value.translation_domain == "tessie"
|
||||
assert error.value.translation_key == "cpd_enabled"
|
||||
|
||||
Reference in New Issue
Block a user