Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: HACS安装集成重启后显示“配置失败。网络连接异常,请检查设备网络配置。“ #210

Open
oMoBai opened this issue Dec 19, 2024 · 9 comments · May be fixed by #458
Assignees
Labels
enhancement New feature or request

Comments

@oMoBai
Copy link

oMoBai commented Dec 19, 2024

Describe the bug / 描述问题

通过方法1或者方法2安装后添加集成时都显示“配置失败。网络连接异常,请检查设备网络配置。”,其他插件可以正常联网,就Xiaomi Home不行

To Reproduce / 复现步骤

1、设置
2、设备与服务-添加集成- Xiaomi Home
image
image

Expected behavior / 预期结果

顺利开始配置

Home Assistant Logs / 系统日志

�[31m2024-12-19 10:44:18.906 ERROR (MainThread) [custom_components.xiaomi_home.miot.miot_network] update_status_and_info task was cancelled�[0m
File "/config/custom_components/xiaomi_home/miot/miot_network.py", line 205, in __get_network_status
File "/config/custom_components/xiaomi_home/miot/miot_network.py", line 192, in __ping
File "/config/custom_components/xiaomi_home/miot/miot_network.py", line 205, in __get_network_status
File "/config/custom_components/xiaomi_home/miot/miot_network.py", line 192, in __ping

Home Assistant Core version / Home Assistant Core 版本

2024.12.4

Home Assistant Operation System version / Home Assistant Operation System 版本

14.0

Xiaomi Home integration version / 米家集成版本

v0.1.2

Additional context / 其他说明

No response

@oMoBai oMoBai added the bug Something isn't working label Dec 19, 2024
@dldui-captain
Copy link

@oMoBai
Copy link
Author

oMoBai commented Dec 19, 2024

采用http://homeassistant.local:8123/链接的吗?

输入home assistant所在的ip地址链接的,问题是出在这里嘛,我homeassistant.local一直不能访问

@oMoBai
Copy link
Author

oMoBai commented Dec 19, 2024

看日志大概搞清楚了,pingcheck的问题,不知是否逻辑有点问题

@topsworld
Copy link
Contributor

看日志大概搞清楚了,pingcheck的问题,不知是否逻辑有点问题

集成判断网络连接使用了ping dns服务器,后续会改成支持用户自定义地址

@topsworld topsworld self-assigned this Dec 19, 2024
@topsworld topsworld added enhancement New feature or request and removed bug Something isn't working labels Dec 19, 2024
@tongxiangzheng
Copy link

原来如此,我所在的学校防火墙禁止向公网传输ICMP协议,即任何ping命令均无法成功,导致了相同问题。希望可以改用其他协议进行检查(例如http访问指定链接)

@loksonlkw
Copy link

修改本地hosts 文件,將homeassistant.local 指向自己的服务器地址就可以了。

@tongxiangzheng
Copy link

读了一下代码,分析我遇到的问题:
我的网络环境无法ping通公网ip,而程序会对PING_ADDRESS_LIST列表中的ip(都是公共dns)发起ping请求,若无法ping通则产生上述错误提示
简单介绍一下我的临时解决办法:
custom_components/xiaomi_home/miot/miot_network.py第190行之后添加一行新的代码(注意缩进要和上一行对齐):
return True
只要跳过检查,让检查函数永远返回True即可

@BernardAu
Copy link

BernardAu commented Dec 19, 2024

我添加完True还是不行:无法加载配置向导: {"message":"Invalid handler specified"}

def __ping(
self, address: Optional[str] = None, timeout: int = 6
) -> bool:
param = '-n' if platform.system().lower() == 'windows' else '-c'
command = ['ping', param, '1', address]
return True
try:

@tongxiangzheng
Copy link

我添加完True还是不行:无法加载配置向导: {"message":"Invalid handler specified"}

def __ping( self, address: Optional[str] = None, timeout: int = 6 ) -> bool: param = '-n' if platform.system().lower() == 'windows' else '-c' command = ['ping', param, '1', address] return True try:

我确实是这样更改的,当然需要注意语句前面的空格要一致,tab和空格不能混用。
我的网络环境的问题是ping不通外网,所以使用这一办法跳过ping的检查,如果服务器无法ping通公网那么这样做可以解决问题,如果可以ping通外网,那么问题可能在其他地方。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants