mirror of
https://github.com/home-assistant/core
synced 2024-10-14 18:30:48 +00:00
Update xknx to 0.21.3 (#72006)
This commit is contained in:
parent
cba2fda93d
commit
81259f4eef
|
@ -2,11 +2,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from xknx import XKNX
|
||||
from xknx.devices import Cover as XknxCover, Device as XknxDevice
|
||||
from xknx.devices import Cover as XknxCover
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.cover import (
|
||||
|
@ -22,9 +21,8 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import async_track_utc_time_change
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DATA_KNX_CONFIG, DOMAIN
|
||||
|
@ -104,13 +102,6 @@ class KNXCover(KnxEntity, CoverEntity):
|
|||
f"{self._device.position_target.group_address}"
|
||||
)
|
||||
|
||||
@callback
|
||||
async def after_update_callback(self, device: XknxDevice) -> None:
|
||||
"""Call after device was updated."""
|
||||
self.async_write_ha_state()
|
||||
if self._device.is_traveling():
|
||||
self.start_auto_updater()
|
||||
|
||||
@property
|
||||
def current_cover_position(self) -> int | None:
|
||||
"""Return the current position of the cover.
|
||||
|
@ -118,8 +109,9 @@ class KNXCover(KnxEntity, CoverEntity):
|
|||
None is unknown, 0 is closed, 100 is fully open.
|
||||
"""
|
||||
# In KNX 0 is open, 100 is closed.
|
||||
pos = self._device.current_position()
|
||||
return 100 - pos if pos is not None else None
|
||||
if (pos := self._device.current_position()) is not None:
|
||||
return 100 - pos
|
||||
return None
|
||||
|
||||
@property
|
||||
def is_closed(self) -> bool | None:
|
||||
|
@ -155,14 +147,12 @@ class KNXCover(KnxEntity, CoverEntity):
|
|||
async def async_stop_cover(self, **kwargs: Any) -> None:
|
||||
"""Stop the cover."""
|
||||
await self._device.stop()
|
||||
self.stop_auto_updater()
|
||||
|
||||
@property
|
||||
def current_cover_tilt_position(self) -> int | None:
|
||||
"""Return current tilt position of cover."""
|
||||
if self._device.supports_angle:
|
||||
ang = self._device.current_angle()
|
||||
return 100 - ang if ang is not None else None
|
||||
if (angle := self._device.current_angle()) is not None:
|
||||
return 100 - angle
|
||||
return None
|
||||
|
||||
async def async_set_cover_tilt_position(self, **kwargs: Any) -> None:
|
||||
|
@ -181,25 +171,3 @@ class KNXCover(KnxEntity, CoverEntity):
|
|||
async def async_stop_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Stop the cover tilt."""
|
||||
await self._device.stop()
|
||||
self.stop_auto_updater()
|
||||
|
||||
def start_auto_updater(self) -> None:
|
||||
"""Start the autoupdater to update Home Assistant while cover is moving."""
|
||||
if self._unsubscribe_auto_updater is None:
|
||||
self._unsubscribe_auto_updater = async_track_utc_time_change(
|
||||
self.hass, self.auto_updater_hook
|
||||
)
|
||||
|
||||
def stop_auto_updater(self) -> None:
|
||||
"""Stop the autoupdater."""
|
||||
if self._unsubscribe_auto_updater is not None:
|
||||
self._unsubscribe_auto_updater()
|
||||
self._unsubscribe_auto_updater = None
|
||||
|
||||
@callback
|
||||
def auto_updater_hook(self, now: datetime) -> None:
|
||||
"""Call for the autoupdater."""
|
||||
self.async_write_ha_state()
|
||||
if self._device.position_reached():
|
||||
self.hass.async_create_task(self._device.auto_stop_if_necessary())
|
||||
self.stop_auto_updater()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "KNX",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/knx",
|
||||
"requirements": ["xknx==0.21.2"],
|
||||
"requirements": ["xknx==0.21.3"],
|
||||
"codeowners": ["@Julius2342", "@farmio", "@marvin-w"],
|
||||
"quality_scale": "platinum",
|
||||
"iot_class": "local_push",
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
"multicast_group": "Used for routing and discovery. Default: `224.0.23.12`",
|
||||
"multicast_port": "Used for routing and discovery. Default: `3671`",
|
||||
"local_ip": "Use `0.0.0.0` for auto-discovery.",
|
||||
"state_updater": "Globally enable or disable reading states from the KNX Bus. When disabled, Home Assistant will not actively retrieve states from the KNX Bus, `sync_state` entity options will have no effect.",
|
||||
"state_updater": "Set default for reading states from the KNX Bus. When disabled, Home Assistant will not actively retrieve entity states from the KNX Bus. Can be overridden by `sync_state` entity options.",
|
||||
"rate_limit": "Maximum outgoing telegrams per second.\nRecommended: 20 to 40"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2454,7 +2454,7 @@ xbox-webapi==2.0.11
|
|||
xboxapi==2.0.1
|
||||
|
||||
# homeassistant.components.knx
|
||||
xknx==0.21.2
|
||||
xknx==0.21.3
|
||||
|
||||
# homeassistant.components.bluesound
|
||||
# homeassistant.components.fritz
|
||||
|
|
|
@ -1612,7 +1612,7 @@ wolf_smartset==0.1.11
|
|||
xbox-webapi==2.0.11
|
||||
|
||||
# homeassistant.components.knx
|
||||
xknx==0.21.2
|
||||
xknx==0.21.3
|
||||
|
||||
# homeassistant.components.bluesound
|
||||
# homeassistant.components.fritz
|
||||
|
|
Loading…
Reference in a new issue