Compare commits

...

3 Commits

Author SHA1 Message Date
Li Shuzhen
f49e76937c
fix: climate entity swing mode setting (#1486)
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled
2025-11-07 10:19:31 +08:00
Li Shuzhen
a1a216aea6
fix: float value precision (#1485) 2025-11-07 10:19:01 +08:00
vshijiav
1ec325c9c7
fix: stop MQTT internal loop immediately when main loop is closed (#1484) 2025-11-07 10:18:25 +08:00
3 changed files with 16 additions and 4 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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]: