mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Adjust rfxtrx cover type hints (#73947)
This commit is contained in:
parent
2f78faa718
commit
6cafcb016f
@ -2,6 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import RFXtrx as rfxtrxmod
|
import RFXtrx as rfxtrxmod
|
||||||
|
|
||||||
@ -65,13 +66,13 @@ class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
|||||||
device: rfxtrxmod.RFXtrxDevice,
|
device: rfxtrxmod.RFXtrxDevice,
|
||||||
device_id: DeviceTuple,
|
device_id: DeviceTuple,
|
||||||
event: rfxtrxmod.RFXtrxEvent = None,
|
event: rfxtrxmod.RFXtrxEvent = None,
|
||||||
venetian_blind_mode: bool | None = None,
|
venetian_blind_mode: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the RFXtrx cover device."""
|
"""Initialize the RFXtrx cover device."""
|
||||||
super().__init__(device, device_id, event)
|
super().__init__(device, device_id, event)
|
||||||
self._venetian_blind_mode = venetian_blind_mode
|
self._venetian_blind_mode = venetian_blind_mode
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Restore device state."""
|
"""Restore device state."""
|
||||||
await super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
|||||||
self._state = old_state.state == STATE_OPEN
|
self._state = old_state.state == STATE_OPEN
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self) -> int:
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
supported_features = (
|
supported_features = (
|
||||||
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
||||||
@ -100,11 +101,11 @@ class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
|||||||
return supported_features
|
return supported_features
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self) -> bool:
|
||||||
"""Return if the cover is closed."""
|
"""Return if the cover is closed."""
|
||||||
return not self._state
|
return not self._state
|
||||||
|
|
||||||
async def async_open_cover(self, **kwargs):
|
async def async_open_cover(self, **kwargs: Any) -> None:
|
||||||
"""Move the cover up."""
|
"""Move the cover up."""
|
||||||
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
||||||
await self._async_send(self._device.send_up05sec)
|
await self._async_send(self._device.send_up05sec)
|
||||||
@ -115,7 +116,7 @@ class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
|||||||
self._state = True
|
self._state = True
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_close_cover(self, **kwargs):
|
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||||
"""Move the cover down."""
|
"""Move the cover down."""
|
||||||
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
||||||
await self._async_send(self._device.send_down05sec)
|
await self._async_send(self._device.send_down05sec)
|
||||||
@ -126,27 +127,27 @@ class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
|||||||
self._state = False
|
self._state = False
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_stop_cover(self, **kwargs):
|
async def async_stop_cover(self, **kwargs: Any) -> None:
|
||||||
"""Stop the cover."""
|
"""Stop the cover."""
|
||||||
await self._async_send(self._device.send_stop)
|
await self._async_send(self._device.send_stop)
|
||||||
self._state = True
|
self._state = True
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_open_cover_tilt(self, **kwargs):
|
async def async_open_cover_tilt(self, **kwargs: Any) -> None:
|
||||||
"""Tilt the cover up."""
|
"""Tilt the cover up."""
|
||||||
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
||||||
await self._async_send(self._device.send_up2sec)
|
await self._async_send(self._device.send_up2sec)
|
||||||
elif self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_EU:
|
elif self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_EU:
|
||||||
await self._async_send(self._device.send_up05sec)
|
await self._async_send(self._device.send_up05sec)
|
||||||
|
|
||||||
async def async_close_cover_tilt(self, **kwargs):
|
async def async_close_cover_tilt(self, **kwargs: Any) -> None:
|
||||||
"""Tilt the cover down."""
|
"""Tilt the cover down."""
|
||||||
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
if self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_US:
|
||||||
await self._async_send(self._device.send_down2sec)
|
await self._async_send(self._device.send_down2sec)
|
||||||
elif self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_EU:
|
elif self._venetian_blind_mode == CONST_VENETIAN_BLIND_MODE_EU:
|
||||||
await self._async_send(self._device.send_down05sec)
|
await self._async_send(self._device.send_down05sec)
|
||||||
|
|
||||||
async def async_stop_cover_tilt(self, **kwargs):
|
async def async_stop_cover_tilt(self, **kwargs: Any) -> None:
|
||||||
"""Stop the cover tilt."""
|
"""Stop the cover tilt."""
|
||||||
await self._async_send(self._device.send_stop)
|
await self._async_send(self._device.send_stop)
|
||||||
self._state = True
|
self._state = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user