mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-07-18 05:29:16 +08:00
feat: set the cover closed position (#1242)
* feat: add the cover closed position configure option * feat: estimate the cover entity's is_closed property by the cover closed position (#944) * fix: translations * feat: set max cover closed position as 5 * docs: modify README * fix: remove useless spaces
This commit is contained in:
@ -120,6 +120,10 @@ INTEGRATION_LANGUAGES = {
|
||||
'zh-Hant': '繁體中文'
|
||||
}
|
||||
|
||||
DEFAULT_COVER_CLOSED_POSITION: int = 0
|
||||
MIN_COVER_CLOSED_POSITION: int = 0
|
||||
MAX_COVER_CLOSED_POSITION: int = 5
|
||||
|
||||
DEFAULT_CTRL_MODE: str = 'auto'
|
||||
|
||||
# Registered in Xiaomi OAuth 2.0 Service
|
||||
|
@ -63,7 +63,8 @@ from .common import MIoTMatcher, slugify_did
|
||||
from .const import (
|
||||
DEFAULT_CTRL_MODE, DEFAULT_INTEGRATION_LANGUAGE, DEFAULT_NICK_NAME, DOMAIN,
|
||||
MIHOME_CERT_EXPIRE_MARGIN, NETWORK_REFRESH_INTERVAL,
|
||||
OAUTH2_CLIENT_ID, SUPPORT_CENTRAL_GATEWAY_CTRL)
|
||||
OAUTH2_CLIENT_ID, SUPPORT_CENTRAL_GATEWAY_CTRL,
|
||||
DEFAULT_COVER_CLOSED_POSITION)
|
||||
from .miot_cloud import MIoTHttpClient, MIoTOauthClient
|
||||
from .miot_error import MIoTClientError, MIoTErrorCode
|
||||
from .miot_mips import (
|
||||
@ -486,6 +487,11 @@ class MIoTClient:
|
||||
def display_binary_bool(self) -> bool:
|
||||
return self._display_binary_bool
|
||||
|
||||
@property
|
||||
def cover_closed_position(self) -> int:
|
||||
return self._entry_data.get('cover_closed_position',
|
||||
DEFAULT_COVER_CLOSED_POSITION)
|
||||
|
||||
@display_devices_changed_notify.setter
|
||||
def display_devices_changed_notify(self, value: list[str]) -> None:
|
||||
if set(value) == set(self._display_devs_notify):
|
||||
|
Reference in New Issue
Block a user