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

登录失败/没有实体等常见问题解决办法 #500

Open
al-one opened this issue Apr 4, 2022 · 0 comments
Open

登录失败/没有实体等常见问题解决办法 #500

al-one opened this issue Apr 4, 2022 · 0 comments
Labels
FAQ Frequently Asked Questions

Comments

@al-one
Copy link
Owner

al-one commented Apr 4, 2022

如果你在使用本插件接入米家设备时遇到无法登录小米账号,或者登录成功后没有出现筛选的设备和实体,请通过下面的方法排查:

  • 登录失败时错误信息会直接显示在配置弹框;
  • 登录成功但没有实体或实体不可用,请先找到相关的报错日志:
    • 点开HA左侧菜单下方的配置
    • 进入系统 > 日志
    • 在上方搜索框输入miot
    • 逐条点开并查看日志详情
    • 关键信息通常在日志详情最底部

检查报错信息/日志中是否有以下类似的内容:

  • Failed to establish a new connection: [Errno -2] Name does not resolve
  • Failed to establish a new connection: [Errno -2] Name or service not known
    • 域名无法解析,出现此报错通常是由于没有配置正确的dns服务器导致的,请检查宿主机、路由器的dns是否含有国外dns如8.8.8.8 等,如有请修改为国内公共dns如阿里223.5.5.5(尤其是群晖)
    • 如果你是hassio/haos,还有可能是你的hassio_dns容器未正常启动的,重启宿主机可解决

  • Failed to establish a new connection: [Errno -3] Try again
  • Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
  • Failed to establish a new connection: [Errno 101] Network unreachable
  • requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.io.mi.com', port=443): Read timed out. (read timeout=10)
  • ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
    • 出现上面几种报错,通常是你的HA无法访问小米服务器导致的,请通过下面几种方法排查:
      • 进入配置 > 系统 > 修复 > 右上角三个点 > 系统信息,找到Xiaomi Miot Auto(没有请按照下面的步骤排查),检查是否有unreach
      • 通过ssh工具或者web ssh执行命令:
        • nslookup api.io.mi.com
        • curl -v https://api.io.mi.com
        • curl -v https://account.xiaomi.com
        • cat /etc/resolv.conf 查看宿主机的dns
      • 如果是docker/supervised版本的HA:
        • docker exec -it homeassistant sh 进入HA容器并执行上面的命令
        • cat /etc/resolv.conf 查看容器中的dns
        • 有朋友反映reboot宿主机之后容器内的/etc/resolv.conf文件中dns服务器被清空
    • 如果你开启了全局代理或VPN,请关闭他们再试
    • 如果上述方法不能帮你找到解决方法,请提交日志和上述方法的结果到issue或交流群寻求帮助


  • tzlocal.utils.ZoneInfoNotFoundError: 'tzlocal() does not support non-zoneinfo timezones like %s. \nPlease use a timezone in the form of Continent/City'
    • 时区未配置或错误,一般docker或core版本的HA才会出现此报错,请检查docker启动命令中是否包含-e TZ=Asia/Shanghai,并检查大小写
    • 再次确认Asia/Shanghai,所有字母大小写都必须正确,且没有Asia/Beijing等,中国时区都是Asia/Shanghai
    • 群晖用户请停止HA容器后修改TZ环境变量的值为Asia/Shanghai,网上某些教程中让添加variable=TZvalue=Asia/Shanghai两个环境变量,请删除它们,这是错误的,只需添加一个TZ=Asia/Shanghai

  • SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate is not yet valid'))
    • SSL证书错误,请检查宿主机时间是否与现实时间一致,如不一致请检查ntp服务器配置并设置为国内ntp服务器
    • 更新ca证书

  • Unable to discover the device 192.168.xxx.yyy
  • Got MiioException while fetching the state: Unable to discover the device 192.168.xxx.yyy
  • OSError: [Errno 64] Host is down
  • OSError: [Errno 65] No route to host
    • 设备无法连接,如果是自动模式接入的WiFi设备,请检查日志中的IP是否和设备实际IP一致,并在集成选项勾选更新设备列表来获取设备最新的IP。最好的解决方法还是通过路由器为设备设置固定IP
    • 如果你划分了子网,请确保HA和设备在同一子网,部分设备需要同一网段才可以连接
    • 如果你选择的是本地模式,请确保筛选设备时包含的都是WiFi设备
    • 设备离线也会出现该报错,检查设备在米家中的状态
    • 尝试给设备断电一次
    • 部分设备如果被频繁获取状态,也会间歇性无法连接,如果你的实体一会可用一会不可用,请提交日志和设备型号到issue
    • 其他案例
Repository owner locked and limited conversation to collaborators Apr 4, 2022
@al-one al-one added the FAQ Frequently Asked Questions label Apr 4, 2022
@al-one al-one pinned this issue Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FAQ Frequently Asked Questions
Projects
None yet
Development

No branches or pull requests

1 participant