Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/components/knx/test_light.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""Test KNX light."""
from __future__ import annotations

from datetime import timedelta

from xknx.devices.light import Light as XknxLight

from homeassistant.components.knx.const import CONF_STATE_ADDRESS, KNX_ADDRESS
from homeassistant.components.knx.schema import LightSchema
from homeassistant.components.light import (
Expand All @@ -19,9 +23,12 @@
)
from homeassistant.const import CONF_NAME, STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.util import dt

from .conftest import KNXTestKit

from tests.common import async_fire_time_changed


async def test_light_simple(hass: HomeAssistant, knx: KNXTestKit):
"""Test simple KNX light."""
Expand Down Expand Up @@ -735,6 +742,12 @@ async def test_light_rgbw_individual(hass: HomeAssistant, knx: KNXTestKit):
# turn OFF from KNX
await knx.receive_write(test_red, (0,))
await knx.receive_write(test_green, (0,))
# # individual color debounce takes 0.2 seconds if not all 4 addresses received
knx.assert_state("light.test", STATE_ON)
async_fire_time_changed(
hass, dt.utcnow() + timedelta(seconds=XknxLight.DEBOUNCE_TIMEOUT)
)
await knx.xknx.task_registry.block_till_done()
knx.assert_state("light.test", STATE_OFF)
# turn ON from KNX
await knx.receive_write(test_red, (0,))
Expand Down