mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-12-13 17:50:30 +08:00
Compare commits
3 Commits
c04fa542a3
...
f49e76937c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f49e76937c | ||
|
|
a1a216aea6 | ||
|
|
1ec325c9c7 |
@ -320,9 +320,15 @@ class FeatureSwingMode(MIoTServiceEntity, ClimateEntity):
|
||||
await self.set_property_async(prop=self._prop_vertical_swing,
|
||||
value=True)
|
||||
elif swing_mode == SWING_HORIZONTAL:
|
||||
if self._prop_vertical_swing:
|
||||
await self.set_property_async(prop=self._prop_vertical_swing,
|
||||
value=False)
|
||||
await self.set_property_async(prop=self._prop_horizontal_swing,
|
||||
value=True)
|
||||
elif swing_mode == SWING_VERTICAL:
|
||||
if self._prop_horizontal_swing:
|
||||
await self.set_property_async(prop=self._prop_horizontal_swing,
|
||||
value=False)
|
||||
await self.set_property_async(prop=self._prop_vertical_swing,
|
||||
value=True)
|
||||
elif swing_mode == SWING_OFF:
|
||||
|
||||
@ -589,6 +589,13 @@ class _MipsClient(ABC):
|
||||
|
||||
def __mqtt_loop_handler(self) -> None:
|
||||
try:
|
||||
# If the main loop is closed, stop the internal loop immediately
|
||||
if self.main_loop.is_closed():
|
||||
self.log_debug(
|
||||
'The main loop is closed, stop the internal loop.')
|
||||
if not self._internal_loop.is_closed():
|
||||
self._internal_loop.stop()
|
||||
return
|
||||
if self._mqtt:
|
||||
self._mqtt.loop_read()
|
||||
if self._mqtt:
|
||||
|
||||
@ -66,7 +66,7 @@ class MIoTSpecValueRange:
|
||||
"""MIoT SPEC value range class."""
|
||||
min_: int
|
||||
max_: int
|
||||
step: int
|
||||
step: int | float
|
||||
|
||||
def __init__(self, value_range: Union[dict, list]) -> None:
|
||||
if isinstance(value_range, dict):
|
||||
@ -567,9 +567,8 @@ class MIoTSpecProperty(_MIoTSpecBase):
|
||||
return
|
||||
self._value_range = MIoTSpecValueRange(value_range=value)
|
||||
if isinstance(value, list):
|
||||
self.precision = len(str(
|
||||
value[2]).split('.')[1].rstrip('0')) if '.' in str(
|
||||
value[2]) else 0
|
||||
step_: str = format(value[2], '.10f').rstrip('0').rstrip('.')
|
||||
self.precision = len(step_.split('.')[1]) if '.' in step_ else 0
|
||||
|
||||
@property
|
||||
def value_list(self) -> Optional[MIoTSpecValueList]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user