Compare commits

...

16 Commits

Author SHA1 Message Date
Feng Wang
f2c689f0ac
Merge a69aa42ce7 into 310029d8ed 2024-12-26 09:12:54 +08:00
Li Shuzhen
310029d8ed
chore: update issue template (#445)
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
2024-12-26 09:11:18 +08:00
Feng Wang
a69aa42ce7 Adjust import order 2024-12-24 21:48:51 +08:00
Feng Wang
626460e156
Merge branch 'main' into remove-tev-dependency 2024-12-24 21:44:35 +08:00
Feng Wang
f614181755 set timers to None after cancel 2024-12-22 20:26:54 +08:00
Feng Wang
fb46bc6b19 change internal class scope 2024-12-22 20:16:45 +08:00
Feng Wang
d3c39f38e1 remove unused data classes 2024-12-22 20:13:38 +08:00
Feng Wang
d13a6bfb11 fix racing condition 2024-12-22 19:51:58 +08:00
Feng Wang
463216d866 do not set asyncio event loop 2024-12-21 23:18:49 +08:00
Feng Wang
30e0433aee revert changes in the license 2024-12-21 23:16:30 +08:00
Feng Wang
0872bf4f69 ignore broad exception warning 2024-12-21 22:11:38 +08:00
Feng Wang
3f77738b90 fix lint 2024-12-21 22:02:19 +08:00
Feng Wang
f288a951b9 add tev back 2024-12-21 21:58:24 +08:00
Feng Wang
569e1512e3 fix lint 2024-12-21 21:52:45 +08:00
Feng Wang
794505f082 Use call_soon_threadsafe instead of event fd for ipc 2024-12-21 21:39:59 +08:00
Feng Wang
faa13c53e8 Remove tev & fix some type issues 2024-12-21 19:09:37 +08:00
5 changed files with 485 additions and 465 deletions

View File

@ -1,4 +1,4 @@
name: Bug report / 报告问题 name: Bug Report / 报告问题
description: Create a report to help us improve. / 报告问题以帮助我们改进 description: Create a report to help us improve. / 报告问题以帮助我们改进
body: body:
- type: input - type: input
@ -33,12 +33,36 @@ body:
validations: validations:
required: true 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 - type: textarea
attributes: attributes:
label: Home Assistant Logs / 系统日志 label: Home Assistant Logs / 系统日志
description: | 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` > [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` > [设置 > 系统 > 日志 > 下载完整日志](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 - type: input
attributes: attributes:

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ import socket
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum, auto from enum import Enum, auto
import subprocess import subprocess
from typing import Callable, Optional from typing import Callable, Coroutine, Optional
import psutil import psutil
import ipaddress import ipaddress
@ -97,7 +97,7 @@ class MIoTNetwork:
_sub_list_network_status: dict[str, Callable[[bool], asyncio.Future]] _sub_list_network_status: dict[str, Callable[[bool], asyncio.Future]]
_sub_list_network_info: dict[str, Callable[[ _sub_list_network_info: dict[str, Callable[[
InterfaceStatus, NetworkInfo], asyncio.Future]] InterfaceStatus, NetworkInfo], Coroutine]]
_ping_address_priority: int _ping_address_priority: int
@ -155,7 +155,7 @@ class MIoTNetwork:
def sub_network_info( def sub_network_info(
self, key: str, self, key: str,
handler: Callable[[InterfaceStatus, NetworkInfo], asyncio.Future] handler: Callable[[InterfaceStatus, NetworkInfo], Coroutine]
) -> None: ) -> None:
self._sub_list_network_info[key] = handler self._sub_list_network_info[key] = handler