Implement mode validation in Climate entity component (#105745)

* Implement mode validation in Climate entity component

* Fix some tests

* more tests

* Fix translations

* fix deconz tests

* Fix switcher_kis tests

* not None

* Fix homematicip_cloud test

* Always validate

* Fix shelly

* reverse logic in validation

* modes_str

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
G Johansson 2023-12-27 14:51:39 +01:00 committed by GitHub
parent e04fda3fad
commit 83f4d3af5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 342 additions and 77 deletions

View file

@ -50,6 +50,7 @@ from homeassistant.const import (
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import entity_registry as er
import homeassistant.util.dt as dt_util
@ -538,7 +539,7 @@ async def test_send_invalid_preset_mode(
"""Test for sending preset mode command to the device."""
await async_setup_gree(hass)
with pytest.raises(ValueError):
with pytest.raises(ServiceValidationError):
await hass.services.async_call(
DOMAIN,
SERVICE_SET_PRESET_MODE,
@ -699,7 +700,7 @@ async def test_send_invalid_fan_mode(
"""Test for sending fan mode command to the device."""
await async_setup_gree(hass)
with pytest.raises(ValueError):
with pytest.raises(ServiceValidationError):
await hass.services.async_call(
DOMAIN,
SERVICE_SET_FAN_MODE,
@ -780,7 +781,7 @@ async def test_send_invalid_swing_mode(
"""Test for sending swing mode command to the device."""
await async_setup_gree(hass)
with pytest.raises(ValueError):
with pytest.raises(ServiceValidationError):
await hass.services.async_call(
DOMAIN,
SERVICE_SET_SWING_MODE,