daxingplay / home-assistant-vaillant-plus

Home Assistant custom component for controlling vSmart in Vaillant+ cn app.
Apache License 2.0
3 stars 2 forks source link

1.2.4登录威能家报错, Core 2024.5.1 Supervisor 2024.04.4 Operating System 12.2 Frontend【前端】 20240501.0 #27

Closed piscesbody closed 1 month ago

piscesbody commented 1 month ago

日志详细信息( ERROR ) 此错误来自自定义集成。 日志: custom_components.vaillant_plus.config_flow 来源: custom_components/vaillant_plus/config_flow.py:65 集成: Vaillant Plus (文档, 问题) 首次发生: 06:39:01 (2 全部发生) 上次记录: 06:42:03

Unexpected exception Traceback (most recent call last): File "/config/custom_components/vaillant_plus/config_flow.py", line 65, in async_step_user user_info = await client.login( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/vaillant_plus_cn_api/api.py", line 128, in login resp = await self._request( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/vaillant_plus_cn_api/api.py", line 96, in _request raise InvalidAuthError vaillant_plus_cn_api.errors.InvalidAuthError

研究了一宿,不知道啥问题,我在命令行里ping 不通vicapi.vaillant.com.cn,环境是威联通NAS虚拟机。

daxingplay commented 1 month ago

如果连不通的话,报错应该是跟 #13 一样的报错。你这里InvalidAuthError 看起来更像是账号密码错误,你看看是不是跟你登录 App 一样的用户名密码。

piscesbody commented 1 month ago

如果连不通的话,报错应该是跟 #13 一样的报错。你这里InvalidAuthError 看起来更像是账号密码错误,你看看是不是跟你登录 App 一样的用户名密码。

我修改了App密码,日志里如果我输入错误的密码,会提示我用户密码错误的日志。我修改hosts文件还是无法ping通这个地址,但是我在自己的电脑是可以ping通的,这是怎么回事呢?大佬方便留个建联系方式吗?有偿请教。🥹

piscesbody commented 1 month ago

大佬,球指点啊,真心需要您这个插件

daxingplay commented 1 month ago

如果连不通的话,报错应该是跟 #13 一样的报错。你这里InvalidAuthError 看起来更像是账号密码错误,你看看是不是跟你登录 App 一样的用户名密码。

我修改了App密码,日志里如果我输入错误的密码,会提示我用户密码错误的日志。我修改hosts文件还是无法ping通这个地址,但是我在自己的电脑是可以ping通的,这是怎么回事呢?大佬方便留个建联系方式吗?有偿请教。🥹

威联通我也不熟,你虚拟机里 能正常解析这个域名吗?另外,traceroute 看看是哪一跳的问题?

piscesbody commented 1 month ago

如果连不通的话,报错应该是跟 #13 一样的报错。你这里InvalidAuthError 看起来更像是账号密码错误,你看看是不是跟你登录 App 一样的用户名密码。

我修改了App密码,日志里如果我输入错误的密码,会提示我用户密码错误的日志。我修改hosts文件还是无法ping通这个地址,但是我在自己的电脑是可以ping通的,这是怎么回事呢?大佬方便留个建联系方式吗?有偿请教。🥹

威联通我也不熟,你虚拟机里 能正常解析这个域名吗?另外,traceroute 看看是哪一跳的问题?

经过测试,我在HA内的命令行工具traceroute vicapi.vaillant.com.cn和ping vicapi.vaillant.com.cn均显示 bad address 'vicapi.vaillant.com.cn',在HA直接ping 47.101.34.198可以ping通,宿主机(威联通)SSH ping和traceroute vicapi.vaillant.com.cn均正常。HA内ping其他ip其他域名也均正常。

HA内traceroute 日志 traceroute to 47.101.34.198 (47.101.34.198), 30 hops max, 46 byte packets 1 iStoreOS.lan (192.168.88.1) 0.305 ms 0.013 ms 0.151 ms 2 175.161.64.1 (175.161.64.1) 3.573 ms 5.959 ms 3.123 ms 3 218.25.12.81 (218.25.12.81) 5.484 ms 218.25.7.113 (218.25.7.113) 3.116 ms 2.843 ms 4 5 219.158.13.173 (219.158.13.173) 37.474 ms 219.158.118.201 (219.158.118.201) 39.394 ms 6 139.226.225.182 (139.226.225.182) 37.423 ms 38.552 ms 139.226.231.106 (139.226.231.106) 34.516 ms 7 139.226.230.146 (139.226.230.146) 43.889 ms 8 140.206.111.202 (140.206.111.202) 37.571 ms 37.651 ms 27.004 ms 9 42.120.241.30 (42.120.241.30) 38.511 ms 10 106.11.75.70 (106.11.75.70) 36.749 ms 48.462 ms 11 12 * 后面都是3个点了。

daxingplay commented 1 month ago

如果连不通的话,报错应该是跟 #13 一样的报错。你这里InvalidAuthError 看起来更像是账号密码错误,你看看是不是跟你登录 App 一样的用户名密码。

我修改了App密码,日志里如果我输入错误的密码,会提示我用户密码错误的日志。我修改hosts文件还是无法ping通这个地址,但是我在自己的电脑是可以ping通的,这是怎么回事呢?大佬方便留个建联系方式吗?有偿请教。🥹

威联通我也不熟,你虚拟机里 能正常解析这个域名吗?另外,traceroute 看看是哪一跳的问题?

经过测试,我在HA内的命令行工具traceroute vicapi.vaillant.com.cn和ping vicapi.vaillant.com.cn均显示 bad address 'vicapi.vaillant.com.cn',在HA直接ping 47.101.34.198可以ping通,宿主机(威联通)SSH ping和traceroute vicapi.vaillant.com.cn均正常。HA内ping其他ip其他域名也均正常。

HA内traceroute 日志

traceroute to 47.101.34.198 (47.101.34.198), 30 hops max, 46 byte packets

1 iStoreOS.lan (192.168.88.1) 0.305 ms 0.013 ms 0.151 ms

2 175.161.64.1 (175.161.64.1) 3.573 ms 5.959 ms 3.123 ms

3 218.25.12.81 (218.25.12.81) 5.484 ms 218.25.7.113 (218.25.7.113) 3.116 ms 2.843 ms

4 *

5 * 219.158.13.173 (219.158.13.173) 37.474 ms 219.158.118.201 (219.158.118.201) 39.394 ms

6 139.226.225.182 (139.226.225.182) 37.423 ms 38.552 ms 139.226.231.106 (139.226.231.106) 34.516 ms

7 139.226.230.146 (139.226.230.146) 43.889 ms

8 140.206.111.202 (140.206.111.202) 37.571 ms 37.651 ms 27.004 ms

9 42.120.241.30 (42.120.241.30) 38.511 ms

10 106.11.75.70 (106.11.75.70) 36.749 ms 48.462 ms *

11 *

12 *

后面都是3个点了。

看起来访问应该正常,你现在登录提示的错误是什么?具体完整的日志贴一下?

piscesbody commented 1 month ago

我尝试输入错误的账户密码,给我返回以下日志,有两个。

日志: vaillant_plus_cn_api
来源: custom_components/vaillant_plus/config_flow.py:65
集成: Vaillant Plus ([文档](https://github.com/daxingplay/home-assistant-vaillant-plus), [问题](https://github.com/daxingplay/home-assistant-vaillant-plus/issues))
首次发生: 16:12:45 (1 全部发生)
上次记录: 16:12:45

Invalid auth. Status: 401. Content: {"code":10003,"msg":"用户名或密码错误","data":{"errorNum":1}}
日志: custom_components.vaillant_plus.config_flow
来源: custom_components/vaillant_plus/config_flow.py:65
集成: Vaillant Plus ([文档](https://github.com/daxingplay/home-assistant-vaillant-plus), [问题](https://github.com/daxingplay/home-assistant-vaillant-plus/issues))
首次发生: 16:12:45 (1 全部发生)
上次记录: 16:12:45

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/vaillant_plus/config_flow.py", line 65, in async_step_user
    user_info = await client.login(
                ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/vaillant_plus_cn_api/api.py", line 128, in login
    resp = await self._request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/vaillant_plus_cn_api/api.py", line 96, in _request
    raise InvalidAuthError
vaillant_plus_cn_api.errors.InvalidAuthError

我再次输入正确的账号和密码,日志如下:

日志: aiohttp.server
来源: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
首次发生: 16:15:54 (1 全部发生)
上次记录: 16:15:54

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp_session/__init__.py", line 199, in factory
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 295, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 71, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 356, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 402, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 506, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vaillant_plus/config_flow.py", line 73, in async_step_user
    device_list = await client.get_device_list()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/vaillant_plus_cn_api/api.py", line 168, in get_device_list
    model_alias=d["modelInfo"]["aliasName"],
                ~~~~~~~~~~~~~~^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
daxingplay commented 1 month ago

那说明网络的确是没问题的。你账号里有威能的壁挂炉或者热水器么?感觉是遇到了不支持的设备。能否打开调试日志,把Vaillant相关的日志都发我看看?

打开调试日志方法:

image

右下角三个点,点一下有打开调试日志的选项。

piscesbody commented 1 month ago

因为没有正常登陆账号,所以我点不出这个的调试。我的账号下面有一台威能的eloCIRC循环水魔方,这个设备是不支持吗?只支持面板控温的那个设备吗?

daxingplay commented 1 month ago

因为没有正常登陆账号,所以我点不出这个的调试。我的账号下面有一台威能的eloCIRC循环水魔方,这个设备是不支持吗?只支持面板控温的那个设备吗?

对,目前只支持威能威精灵,控制壁挂炉。

piscesbody commented 1 month ago

明白,感谢🙏