mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 17:18:23 +00:00
Adjust cover
This commit is contained in:
parent
12006e7255
commit
27a266d054
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from tuya_sharing import CustomerDevice, Manager
|
from tuya_sharing import CustomerDevice, Manager
|
||||||
|
|
||||||
@ -16,12 +16,11 @@ from homeassistant.components.cover import (
|
|||||||
CoverEntityFeature,
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
|
|
||||||
from . import TuyaConfigEntry
|
from . import TuyaConfigEntry
|
||||||
from .const import DOMAIN, TUYA_DISCOVERY_NEW, DPCode, DPType
|
from .const import TUYA_DISCOVERY_NEW, DPCode, DPType
|
||||||
from .entity import TuyaEntity
|
from .entity import TuyaEntity
|
||||||
from .models import IntegerTypeData
|
from .models import IntegerTypeData
|
||||||
|
|
||||||
@ -334,11 +333,9 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity):
|
|||||||
|
|
||||||
def set_cover_position(self, **kwargs: Any) -> None:
|
def set_cover_position(self, **kwargs: Any) -> None:
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
if self._set_position is None:
|
if TYPE_CHECKING:
|
||||||
raise ServiceValidationError(
|
# guarded by CoverEntityFeature.SET_POSITION
|
||||||
translation_domain=DOMAIN,
|
assert self._set_position is not None
|
||||||
translation_key="action_dpcode_not_found",
|
|
||||||
)
|
|
||||||
|
|
||||||
self._send_command(
|
self._send_command(
|
||||||
[
|
[
|
||||||
@ -366,11 +363,9 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity):
|
|||||||
|
|
||||||
def set_cover_tilt_position(self, **kwargs: Any) -> None:
|
def set_cover_tilt_position(self, **kwargs: Any) -> None:
|
||||||
"""Move the cover tilt to a specific position."""
|
"""Move the cover tilt to a specific position."""
|
||||||
if self._tilt is None:
|
if TYPE_CHECKING:
|
||||||
raise ServiceValidationError(
|
# guarded by CoverEntityFeature.SET_TILT_POSITION
|
||||||
translation_domain=DOMAIN,
|
assert self._tilt is not None
|
||||||
translation_key="action_dpcode_not_found",
|
|
||||||
)
|
|
||||||
|
|
||||||
self._send_command(
|
self._send_command(
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user