mirror of https://github.com/home-assistant/core
Bump pyvlx to 0.2.21 (#105800)
* Bump pyvlx to 0.2.21 * Fix typing * Optimize fix
This commit is contained in:
parent
d5c7ae5b34
commit
dfc7ff8e64
|
@ -1,7 +1,7 @@
|
|||
"""Support for VELUX KLF 200 devices."""
|
||||
import logging
|
||||
|
||||
from pyvlx import OpeningDevice, PyVLX, PyVLXException
|
||||
from pyvlx import Node, PyVLX, PyVLXException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
@ -90,7 +90,7 @@ class VeluxEntity(Entity):
|
|||
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(self, node: OpeningDevice) -> None:
|
||||
def __init__(self, node: Node) -> None:
|
||||
"""Initialize the Velux device."""
|
||||
self.node = node
|
||||
self._attr_unique_id = node.serial_number
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Velux covers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from pyvlx import OpeningDevice, Position
|
||||
from pyvlx.opening_device import Awning, Blind, GarageDoor, Gate, RollerShutter, Window
|
||||
|
@ -40,6 +40,7 @@ class VeluxCover(VeluxEntity, CoverEntity):
|
|||
"""Representation of a Velux cover."""
|
||||
|
||||
_is_blind = False
|
||||
node: OpeningDevice
|
||||
|
||||
def __init__(self, node: OpeningDevice) -> None:
|
||||
"""Initialize VeluxCover."""
|
||||
|
@ -86,7 +87,7 @@ class VeluxCover(VeluxEntity, CoverEntity):
|
|||
def current_cover_tilt_position(self) -> int | None:
|
||||
"""Return the current position of the cover."""
|
||||
if self._is_blind:
|
||||
return 100 - self.node.orientation.position_percent
|
||||
return 100 - cast(Blind, self.node).orientation.position_percent
|
||||
return None
|
||||
|
||||
@property
|
||||
|
@ -116,20 +117,20 @@ class VeluxCover(VeluxEntity, CoverEntity):
|
|||
|
||||
async def async_close_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Close cover tilt."""
|
||||
await self.node.close_orientation(wait_for_completion=False)
|
||||
await cast(Blind, self.node).close_orientation(wait_for_completion=False)
|
||||
|
||||
async def async_open_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Open cover tilt."""
|
||||
await self.node.open_orientation(wait_for_completion=False)
|
||||
await cast(Blind, self.node).open_orientation(wait_for_completion=False)
|
||||
|
||||
async def async_stop_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Stop cover tilt."""
|
||||
await self.node.stop_orientation(wait_for_completion=False)
|
||||
await cast(Blind, self.node).stop_orientation(wait_for_completion=False)
|
||||
|
||||
async def async_set_cover_tilt_position(self, **kwargs: Any) -> None:
|
||||
"""Move cover tilt to a specific position."""
|
||||
position_percent = 100 - kwargs[ATTR_TILT_POSITION]
|
||||
orientation = Position(position_percent=position_percent)
|
||||
await self.node.set_orientation(
|
||||
await cast(Blind, self.node).set_orientation(
|
||||
orientation=orientation, wait_for_completion=False
|
||||
)
|
||||
|
|
|
@ -35,6 +35,8 @@ class VeluxLight(VeluxEntity, LightEntity):
|
|||
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||
|
||||
node: LighteningDevice
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
"""Return the current brightness."""
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
"documentation": "https://www.home-assistant.io/integrations/velux",
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["pyvlx"],
|
||||
"requirements": ["pyvlx==0.2.20"]
|
||||
"requirements": ["pyvlx==0.2.21"]
|
||||
}
|
||||
|
|
|
@ -2287,7 +2287,7 @@ pyvesync==2.1.10
|
|||
pyvizio==0.1.61
|
||||
|
||||
# homeassistant.components.velux
|
||||
pyvlx==0.2.20
|
||||
pyvlx==0.2.21
|
||||
|
||||
# homeassistant.components.volumio
|
||||
pyvolumio==0.1.5
|
||||
|
|
Loading…
Reference in New Issue