mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-07-17 21:19:10 +08:00
fix: airer status for cover entity (#1235)
* fix: xiaomi.airer.pro3 airer status rising (#1222) * fix: airer status * fix: filter out non alphabetic characters from status descriptions
This commit is contained in:
@ -46,8 +46,9 @@ off Xiaomi or its affiliates' products.
|
||||
Cover entities for Xiaomi Home.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import logging
|
||||
from typing import Any, Optional
|
||||
import re
|
||||
import logging
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -97,7 +98,6 @@ class Cover(MIoTServiceEntity, CoverEntity):
|
||||
_prop_status: Optional[MIoTSpecProperty]
|
||||
_prop_status_opening: Optional[list[int]]
|
||||
_prop_status_closing: Optional[list[int]]
|
||||
_prop_status_stop: Optional[list[int]]
|
||||
_prop_status_closed: Optional[list[int]]
|
||||
_prop_current_position: Optional[MIoTSpecProperty]
|
||||
_prop_target_position: Optional[MIoTSpecProperty]
|
||||
@ -122,7 +122,6 @@ class Cover(MIoTServiceEntity, CoverEntity):
|
||||
self._prop_status = None
|
||||
self._prop_status_opening = []
|
||||
self._prop_status_closing = []
|
||||
self._prop_status_stop = []
|
||||
self._prop_status_closed = []
|
||||
self._prop_current_position = None
|
||||
self._prop_target_position = None
|
||||
@ -159,13 +158,21 @@ class Cover(MIoTServiceEntity, CoverEntity):
|
||||
self.entity_id)
|
||||
continue
|
||||
for item in prop.value_list.items:
|
||||
if item.name in {'opening', 'open', 'up'}:
|
||||
item_str: str = item.name
|
||||
item_name: str = re.sub(r'[^a-z]', '', item_str)
|
||||
if item_name in {
|
||||
'opening', 'open', 'up', 'uping', 'rise', 'rising'
|
||||
}:
|
||||
self._prop_status_opening.append(item.value)
|
||||
elif item.name in {'closing', 'close', 'down', 'dowm'}:
|
||||
elif item_name in {
|
||||
'closing', 'close', 'down', 'dowm', 'falling',
|
||||
'dropping', 'downing', 'lower'
|
||||
}:
|
||||
self._prop_status_closing.append(item.value)
|
||||
elif item.name in {'stop', 'stopped', 'pause'}:
|
||||
self._prop_status_stop.append(item.value)
|
||||
elif item.name in {'closed'}:
|
||||
elif item_name in {
|
||||
'stopatlowest', 'stoplowerlimit', 'lowerlimitstop',
|
||||
'floor', 'lowerlimit'
|
||||
}:
|
||||
self._prop_status_closed.append(item.value)
|
||||
self._prop_status = prop
|
||||
elif prop.name == 'current-position':
|
||||
|
@ -1178,7 +1178,7 @@ class MipsLocalClient(_MipsClient):
|
||||
or 'piid' not in msg
|
||||
or 'value' not in msg
|
||||
):
|
||||
# self.log_error(f'on_prop_msg, recv unknown msg, {payload}')
|
||||
self.log_info('unknown prop msg, %s', payload)
|
||||
return
|
||||
if handler:
|
||||
self.log_debug('local, on properties_changed, %s', payload)
|
||||
|
Reference in New Issue
Block a user