Update xknx to version 0.18.1 (#49609)

This commit is contained in:
Matthias Alphart 2021-04-24 14:18:14 +02:00 committed by GitHub
parent 9a7d500b80
commit 671148b6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 13 deletions

View File

@ -15,7 +15,8 @@ from xknx.io import (
ConnectionConfig,
ConnectionType,
)
from xknx.telegram import AddressFilter, GroupAddress, Telegram
from xknx.telegram import AddressFilter, Telegram
from xknx.telegram.address import parse_device_group_address
from xknx.telegram.apci import GroupValueRead, GroupValueResponse, GroupValueWrite
from homeassistant.const import (
@ -412,7 +413,7 @@ class KNXModule:
async def service_event_register_modify(self, call: ServiceCall) -> None:
"""Service for adding or removing a GroupAddress to the knx_event filter."""
attr_address = call.data[KNX_ADDRESS]
group_addresses = map(GroupAddress, attr_address)
group_addresses = map(parse_device_group_address, attr_address)
if call.data.get(SERVICE_KNX_ATTR_REMOVE):
for group_address in group_addresses:
@ -483,7 +484,7 @@ class KNXModule:
for address in attr_address:
telegram = Telegram(
destination_address=GroupAddress(address),
destination_address=parse_device_group_address(address),
payload=GroupValueWrite(payload),
)
await self.xknx.telegrams.put(telegram)
@ -492,7 +493,7 @@ class KNXModule:
"""Service for sending a GroupValueRead telegram to the KNX bus."""
for address in call.data[KNX_ADDRESS]:
telegram = Telegram(
destination_address=GroupAddress(address),
destination_address=parse_device_group_address(address),
payload=GroupValueRead(),
)
await self.xknx.telegrams.put(telegram)

View File

@ -2,7 +2,7 @@
"domain": "knx",
"name": "KNX",
"documentation": "https://www.home-assistant.io/integrations/knx",
"requirements": ["xknx==0.18.0"],
"requirements": ["xknx==0.18.1"],
"codeowners": ["@Julius2342", "@farmio", "@marvin-w"],
"quality_scale": "silver",
"iot_class": "local_push"

View File

@ -1,8 +1,13 @@
"""Voluptuous schemas for the KNX integration."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from xknx.devices.climate import SetpointShiftMode
from xknx.exceptions import CouldNotParseAddress
from xknx.io import DEFAULT_MCAST_PORT
from xknx.telegram.address import GroupAddress, IndividualAddress
from xknx.telegram.address import IndividualAddress, parse_device_group_address
from homeassistant.const import (
CONF_DEVICE_CLASS,
@ -29,11 +34,20 @@ from .const import (
# KNX VALIDATORS
##################
ga_validator = vol.Any(
cv.matches_regex(GroupAddress.ADDRESS_RE.pattern),
vol.All(vol.Coerce(int), vol.Range(min=1, max=65535)),
msg="value does not match pattern for KNX group address '<main>/<middle>/<sub>', '<main>/<sub>' or '<free>' (eg.'1/2/3', '9/234', '123')",
)
def ga_validator(value: Any) -> str | int:
"""Validate that value is parsable as GroupAddress or InternalGroupAddress."""
if isinstance(value, (str, int)):
try:
parse_device_group_address(value)
return value
except CouldNotParseAddress:
pass
raise vol.Invalid(
f"value '{value}' is not a valid KNX group address '<main>/<middle>/<sub>', '<main>/<sub>' or '<free>' (eg.'1/2/3', '9/234', '123'), nor xknx internal address 'i-<string>'."
)
ga_list_validator = vol.All(cv.ensure_list, [ga_validator])
ia_validator = vol.Any(

View File

@ -2353,7 +2353,7 @@ xbox-webapi==2.0.8
xboxapi==2.0.1
# homeassistant.components.knx
xknx==0.18.0
xknx==0.18.1
# homeassistant.components.bluesound
# homeassistant.components.rest

View File

@ -1244,7 +1244,7 @@ wolf_smartset==0.1.8
xbox-webapi==2.0.8
# homeassistant.components.knx
xknx==0.18.0
xknx==0.18.1
# homeassistant.components.bluesound
# homeassistant.components.rest