diff --git a/tests/components/evohome/test_services.py b/tests/components/evohome/test_services.py index 584d3e544ecc..b6876d355452 100644 --- a/tests/components/evohome/test_services.py +++ b/tests/components/evohome/test_services.py @@ -138,6 +138,27 @@ async def test_clear_zone_override( mock_fcn.assert_awaited_once_with() +@pytest.mark.parametrize("install", ["default"]) +async def test_clear_zone_override_legacy( + hass: HomeAssistant, + zone_id: str, +) -> None: + """Test Evohome's clear_zone_override service with the legacy entity_id.""" + + # EvoZoneMode.FOLLOW_SCHEDULE + with patch("evohomeasync2.zone.Zone.reset") as mock_fcn: + await hass.services.async_call( + DOMAIN, + EvoService.CLEAR_ZONE_OVERRIDE, + { + ATTR_ENTITY_ID: zone_id, + }, + blocking=True, + ) + + mock_fcn.assert_awaited_once_with() + + @pytest.mark.parametrize("install", ["default"]) async def test_set_zone_override( hass: HomeAssistant, @@ -180,6 +201,48 @@ async def test_set_zone_override( ) +@pytest.mark.parametrize("install", ["default"]) +async def test_set_zone_override_legacy( + hass: HomeAssistant, + zone_id: str, + freezer: FrozenDateTimeFactory, +) -> None: + """Test Evohome's set_zone_override service with the legacy entity_id.""" + + freezer.move_to("2024-07-10T12:00:00+00:00") + + # EvoZoneMode.PERMANENT_OVERRIDE + with patch("evohomeasync2.zone.Zone.set_temperature") as mock_fcn: + await hass.services.async_call( + DOMAIN, + EvoService.SET_ZONE_OVERRIDE, + { + ATTR_ENTITY_ID: zone_id, + ATTR_SETPOINT: 19.5, + }, + blocking=True, + ) + + mock_fcn.assert_awaited_once_with(19.5, until=None) + + # EvoZoneMode.TEMPORARY_OVERRIDE + with patch("evohomeasync2.zone.Zone.set_temperature") as mock_fcn: + await hass.services.async_call( + DOMAIN, + EvoService.SET_ZONE_OVERRIDE, + { + ATTR_ENTITY_ID: zone_id, + ATTR_SETPOINT: 19.5, + ATTR_DURATION: {"minutes": 135}, + }, + blocking=True, + ) + + mock_fcn.assert_awaited_once_with( + 19.5, until=datetime(2024, 7, 10, 14, 15, tzinfo=UTC) + ) + + @pytest.mark.parametrize("install", ["default"]) @pytest.mark.parametrize( ("service", "service_data"),