Update xknx to 3.0.0 - more DPT definitions (#122891)

* Support DPTComplex objects and validate sensor types

* Gracefully start and stop xknx device objects

* Use non-awaitable XknxDevice callbacks

* Use non-awaitable xknx.TelegramQueue callbacks

* Use non-awaitable xknx.ConnectionManager callbacks

* Remove unnecessary `hass.async_block_till_done()` calls

* Wait for StateUpdater logic to proceed when receiving responses

* Update import module paths for specific DPTs

* Support Enum data types

* New HVAC mode names

* HVAC Enums instead of Enum member value strings

* New date and time devices

* Update xknx to 3.0.0

* Fix expose tests and DPTEnumData check

* ruff and mypy fixes
This commit is contained in:
Matthias Alphart 2024-07-31 09:10:36 +02:00 committed by GitHub
parent 0d678120e4
commit 9351f300b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 217 additions and 286 deletions

View file

@ -1,9 +1,8 @@
"""Test KNX expose."""
from datetime import timedelta
import time
from unittest.mock import patch
from freezegun import freeze_time
import pytest
from homeassistant.components.knx import CONF_KNX_EXPOSE, DOMAIN, KNX_ADDRESS
@ -327,25 +326,32 @@ async def test_expose_conversion_exception(
)
@patch("time.localtime")
@freeze_time("2022-1-7 9:13:14")
@pytest.mark.parametrize(
("time_type", "raw"),
[
("time", (0xA9, 0x0D, 0x0E)), # localtime includes day of week
("date", (0x07, 0x01, 0x16)),
("datetime", (0x7A, 0x1, 0x7, 0xA9, 0xD, 0xE, 0x20, 0xC0)),
],
)
async def test_expose_with_date(
localtime, hass: HomeAssistant, knx: KNXTestKit
hass: HomeAssistant, knx: KNXTestKit, time_type: str, raw: tuple[int, ...]
) -> None:
"""Test an expose with a date."""
localtime.return_value = time.struct_time([2022, 1, 7, 9, 13, 14, 6, 0, 0])
await knx.setup_integration(
{
CONF_KNX_EXPOSE: {
CONF_TYPE: "datetime",
CONF_TYPE: time_type,
KNX_ADDRESS: "1/1/8",
}
}
)
await knx.assert_write("1/1/8", (0x7A, 0x1, 0x7, 0xE9, 0xD, 0xE, 0x20, 0x80))
await knx.assert_write("1/1/8", raw)
await knx.receive_read("1/1/8")
await knx.assert_response("1/1/8", (0x7A, 0x1, 0x7, 0xE9, 0xD, 0xE, 0x20, 0x80))
await knx.assert_response("1/1/8", raw)
entries = hass.config_entries.async_entries(DOMAIN)
assert len(entries) == 1