mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Add tests for KNX scene (#58900)
This commit is contained in:
parent
4d4d778598
commit
56b7f94bbc
44
tests/components/knx/test_scene.py
Normal file
44
tests/components/knx/test_scene.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
"""Test KNX scene."""
|
||||||
|
|
||||||
|
from homeassistant.components.knx.const import KNX_ADDRESS
|
||||||
|
from homeassistant.components.knx.schema import SceneSchema
|
||||||
|
from homeassistant.const import (
|
||||||
|
CONF_ENTITY_CATEGORY,
|
||||||
|
CONF_NAME,
|
||||||
|
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_registry import (
|
||||||
|
async_get_registry as async_get_entity_registry,
|
||||||
|
)
|
||||||
|
|
||||||
|
from .conftest import KNXTestKit
|
||||||
|
|
||||||
|
|
||||||
|
async def test_activate_knx_scene(hass: HomeAssistant, knx: KNXTestKit):
|
||||||
|
"""Test KNX scene."""
|
||||||
|
await knx.setup_integration(
|
||||||
|
{
|
||||||
|
SceneSchema.PLATFORM_NAME: [
|
||||||
|
{
|
||||||
|
CONF_NAME: "test",
|
||||||
|
SceneSchema.CONF_SCENE_NUMBER: 24,
|
||||||
|
KNX_ADDRESS: "1/1/1",
|
||||||
|
CONF_ENTITY_CATEGORY: ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
assert len(hass.states.async_all()) == 1
|
||||||
|
|
||||||
|
registry = await async_get_entity_registry(hass)
|
||||||
|
entity = registry.async_get("scene.test")
|
||||||
|
assert entity.entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
|
assert entity.unique_id == "1/1/1_24"
|
||||||
|
|
||||||
|
await hass.services.async_call(
|
||||||
|
"scene", "turn_on", {"entity_id": "scene.test"}, blocking=True
|
||||||
|
)
|
||||||
|
|
||||||
|
# assert scene was called on bus
|
||||||
|
await knx.assert_write("1/1/1", (0x17,))
|
Loading…
x
Reference in New Issue
Block a user