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

获取登录授权信息(OAuth token)失败 #318

Open
Blackiler opened this issue Dec 21, 2024 · 2 comments
Open

获取登录授权信息(OAuth token)失败 #318

Blackiler opened this issue Dec 21, 2024 · 2 comments
Assignees

Comments

@Blackiler
Copy link

Describe the Bug / 描述问题

登陆账号后返回homeassistant提示

How to Reproduce / 复现步骤

  1. 在hass小米集成弹窗点击“点击此处进行登录”
  2. 进入小米账号页登录并确认授权
  3. xiaomi_home提示:登录出现错误 点击“下一步”重试 获取登录授权信息(OAuth token)失败。

Expected Behavior / 预期结果

成功获取信息

Home Assistant Logs / 系统日志

日志记录器: custom_components.xiaomi_home.config_flow
来源: custom_components/xiaomi_home/config_flow.py:315
集成: xiaomi_home (文档, 问题)
首次出现: 14:06:34 (2 次总计出现)
上次记录: 14:06:38

task_oauth exception, get_token_error

Home Assistant Core Version / Home Assistant Core 版本

2024.11.3

Home Assistant Operation System Version / Home Assistant Operation System 版本

Xiaomi Home Integration Version / 米家集成版本

v0.1.4b0

Additional Context / 其他说明

No response

@topsworld
Copy link
Contributor

@Blackiler 您好,除了这条错误日志,还有其它错误日志吗?

@paco9527
Copy link

我这也有相同的现象,贴上我这除了楼主日志以外的另外一条系统日志

因为日志看着有点奇怪决定先叠甲orz: HA的网页上下载插件又是正常的,设置->系统->网络->配置网络接口 IPV4里填了两个DNS服务器,一个是网关另一个是8.8.8.8

Describe the Bug / 描述问题

登陆账号后返回homeassistant提示

How to Reproduce / 复现步骤

在hass小米集成弹窗点击“点击此处进行登录”
进入小米账号页登录并确认授权
xiaomi_home提示:登录出现错误 点击“下一步”重试 获取登录授权信息(OAuth token)失败。
Expected Behavior / 预期结果
成功获取信息

Home Assistant Logs / 系统日志

此错误来自自定义集成。

日志记录器: custom_components.xiaomi_home.config_flow
来源: custom_components/xiaomi_home/config_flow.py:357
集成: Xiaomi Home (文档, 问题)
首次出现: 11:09:26 (1 次总计出现)
上次记录: 11:09:26

get_access_token, Cannot connect to host ha.api.io.mi.com:443 ssl:default [Could not contact DNS servers], Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/aiohttp/resolver.py", line 103, in resolve resp = await self._resolver.getaddrinfo( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ aiodns.error.DNSError: (11, 'Could not contact DNS servers') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1351, in _create_direct_connection hosts = await self._resolve_host(host, port, traces=traces) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 995, in _resolve_host return await asyncio.shield(resolved_host_task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1026, in _resolve_host_with_throttle addrs = await self._resolver.resolve(host, port, family=self._family) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/resolver.py", line 112, in resolve raise OSError(None, msg) from exc OSError: [Errno None] Could not contact DNS servers The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/xiaomi_home/config_flow.py", line 337, in __check_oauth_async auth_info = await self._miot_oauth.get_access_token_async( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ code=oauth_code) ^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/miot/miot_cloud.py", line 189, in get_access_token_async return await self.__get_token_async(data={ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... }) ^^ File "/config/custom_components/xiaomi_home/miot/miot_cloud.py", line 145, in __get_token_async http_res = await self._session.get( ^^^^^^^^^^^^^^^^^^^^^^^^ ...<4 lines>... ) ^ File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 703, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ req, traces=traces, timeout=real_timeout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 548, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1056, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1357, in _create_direct_connection raise ClientConnectorDNSError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorDNSError: Cannot connect to host ha.api.io.mi.com:443 ssl:default [Could not contact DNS servers]

Home Assistant Core Version / Home Assistant Core 版本

2024.12.5

Home Assistant Operation System Version / Home Assistant Operation System 版本

14.1

Xiaomi Home Integration Version / 米家集成版本

v0.1.4b0

Additional Context / 其他说明

不确定会不会是HAOS的问题,安装集成的时候连clone这个仓库都会提示Could not resolve host github.com,手动改了resolv.conf(nameserver 我自己的网关)才能clone下来

改完resolv.conf再去添加集成还是会获取授权失败,设置里能看见有相同的日志刷出来

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

No branches or pull requests

3 participants