Skip to content
Snippets Groups Projects
Unverified Commit dfc7ff8e authored by DeerMaximum's avatar DeerMaximum Committed by GitHub
Browse files

Bump pyvlx to 0.2.21 (#105800)

* Bump pyvlx to 0.2.21

* Fix typing

* Optimize fix
parent d5c7ae5b
No related branches found
No related tags found
No related merge requests found
"""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
......
"""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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment