Merge branch 'main' into feat-entities-filter

This commit is contained in:
Paul Shawn 2024-12-30 20:59:35 +08:00 committed by GitHub
commit c4bc72df45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 515 additions and 470 deletions

View File

@ -1,4 +1,4 @@
name: Bug report / 报告问题
name: Bug Report / 报告问题
description: Create a report to help us improve. / 报告问题以帮助我们改进
body:
- type: input
@ -33,12 +33,36 @@ body:
validations:
required: true
- type: input
attributes:
label: Reproduce Time / 问题复现的时间点
description: |
> Year-month-day, 24-hour time.
> 年-月-日24小时制。
placeholder: "2025-01-01 17:00:00"
validations:
required: true
- type: textarea
attributes:
label: Home Assistant Logs / 系统日志
description: |
> Please [set the log level](https://github.com/XiaoMi/ha_xiaomi_home/blob/main/CONTRIBUTING.md#reporting-bugs) to `debug` and try to reproduce the problem.
> [Settings > System > Logs > DOWNLOAD FULL LOG](https://my.home-assistant.io/redirect/logs) > Filter `xiaomi_home`
> If you are concerned about privacy, you can send the log to ha_xiaomi_home@xiaomi.com . The mail body should include the link to this issue.
> 请将[日志级别设置](https://github.com/XiaoMi/ha_xiaomi_home/blob/main/doc/CONTRIBUTING_zh.md#%E6%88%91%E5%8F%AF%E4%BB%A5%E5%A6%82%E4%BD%95%E8%B4%A1%E7%8C%AE)为 `debug` 并尝试复现问题。
> [设置 > 系统 > 日志 > 下载完整日志](https://my.home-assistant.io/redirect/logs) > 筛选 `xiaomi_home`
> 如果您担心隐私问题,可将日志发送至 ha_xiaomi_home@xiaomi.com ,邮件正文附上此问题的链接。
- type: input
attributes:
label: Log Timezone / 日志时区
description: |
> The [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the timestamp in the log.
> 日志所用时间戳的[时区](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)。
placeholder: "Asia/Shanghai"
validations:
required: true
- type: input
attributes:

View File

@ -83,6 +83,9 @@ def randomize_int(value: int, ratio: float) -> int:
"""Randomize an integer value."""
return int(value * (1 - ratio + random.random()*2*ratio))
def randomize_float(value: float, ratio: float) -> float:
"""Randomize a float value."""
return value * (1 - ratio + random.random()*2*ratio)
class MIoTMatcher(MQTTMatcher):
"""MIoT Pub/Sub topic matcher."""

View File

@ -1089,7 +1089,7 @@ class MIoTClient:
handler=self.__on_lan_device_state_changed)
for did, info in (
await self._miot_lan.get_dev_list_async()).items():
self.__on_lan_device_state_changed(
await self.__on_lan_device_state_changed(
did=did, state=info, ctx=None)
_LOGGER.info('lan device list, %s', self._device_list_lan)
self._miot_lan.update_devices(devices={

View File

@ -74,6 +74,7 @@ class MIoTErrorCode(Enum):
# Config flow error code, -10100
# Options flow error code , -10110
# MIoT lan error code, -10120
CODE_LAN_UNAVAILABLE = -10120
class MIoTError(Exception):
@ -141,3 +142,7 @@ class MIoTConfigError(MIoTError):
class MIoTOptionsError(MIoTError):
...
class MIoTLanError(MIoTError):
...

File diff suppressed because it is too large Load Diff

View File

@ -107,7 +107,6 @@ class MIoTNetwork:
_sub_list_network_status: dict[str, Callable[[bool], Coroutine]]
_sub_list_network_info: dict[str, Callable[[
InterfaceStatus, NetworkInfo], Coroutine]]
_done_event: asyncio.Event
def __init__(