async def test_proactive_adaptation(hass):
    """Validate that a proactive adaptation updates the original service call."""
    switch, _ = await setup_lights_and_switch(hass, {CONF_INTERCEPT: True}, True)

    _mock_sun_light_settings(
        switch,
        {
            ATTR_BRIGHTNESS_PCT: 67,
            ATTR_COLOR_TEMP_KELVIN: 3448,
            "force_rgb_color": False,
        },
    )

    event_context_ids = await _turn_on_and_track_event_contexts(
        hass,
        "test_context",
        ENTITY_LIGHT_3,
    )

    # Expect a single service call
    assert len(event_context_ids) == 1
    assert event_context_ids == ["test_context"]

    # Expect adapted light state
    state = hass.states.get(ENTITY_LIGHT_3)
    # Sun light settings use %, state only contains absolute
    assert state.attributes[ATTR_BRIGHTNESS] == 171  # == 67%
    assert state.attributes[ATTR_COLOR_TEMP_KELVIN] == 3448
Validate that a proactive adaptation updates the original service call.
tests/test_switch.py