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

UnknownError using tesla_custom.api #145

Closed
1043717432 opened this issue Feb 10, 2022 · 6 comments
Closed

UnknownError using tesla_custom.api #145

1043717432 opened this issue Feb 10, 2022 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@1043717432
Copy link

1043717432 commented Feb 10, 2022

Can't seem to get any tesla_custom.api service calls to work.

Both the above examples return an UnknownError immediately. I imagine i'm doing something wrong, but not sure what. I grabbed the vehicle_id from teslafi - it should always be the same, right?

Version of the custom_component

版本 core-2022.2.5
安装类型 Home Assistant Container
开发版 false
Supervisor false
Docker true
用户 root
虚拟环境 false
Python 版本 3.9.7
操作系统系列 Linux
操作系统版本 4.19.0-14-amd64
CPU 架构 x86_64
时区 Asia/Shanghai
-->

Configuration

Describe the bug

A clear and concise description of what the bug is.

Debug log

2022-02-10 16:53:42 DEBUG (MainThread) [teslajsonpy.controller] 320 endpoints loaded
2022-02-10 16:53:42 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19034 days, 7:06:18
2022-02-10 16:53:42 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
2022-02-10 16:53:42 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
2022-02-10 16:53:42 DEBUG (MainThread) [teslajsonpy.connection] Saved new auth info {'access_token': '8Awy40BhR4loGGH4Z6FmAHy7D9DBmKo3vzynnWkh0QozHy09D6x5JafbsE5ca9vMHFgdB3K8FDsTxW_yAdq3F12czP8yi83yECS1V-ec-kt-n8Z1o7i9', 'refresh_token': '', 'expires_in': 1644533822}
2022-02-10 16:53:42 DEBUG (MainThread) [teslajsonpy.connection] Exchanging bearer token with access token:
2022-02-10 16:54:13 INFO (MainThread) [teslajsonpy.controller] Backing off get_vehicles(...) for 0.6s (httpx.ConnectError: All connection attempts failed)
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 203, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 221, in _async_init
flow = await self.async_create_flow(handler, context=context, data=data)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 740, in async_create_flow
raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
2022-02-10 16:54:46 ERROR (MainThread) [teslajsonpy.controller] Giving up get_vehicles(...) after 2 tries (httpx.ConnectError: All connection attempts failed)
2022-02-10 16:54:46 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 127, in try_connect
stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1518, in connect_tcp
await get_running_loop().create_connection(StreamProtocol, host, port,
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
return await fut
File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('52.81.252.153', 443)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
yield
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 101, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 184, in connect_tcp
raise OSError('All connection attempts failed') from cause
OSError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 308, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 244, in handle_async_request
raise exc
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 228, in handle_async_request
response = await connection.handle_async_request(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
raise exc
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
stream = await self._connect(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/auto.py", line 23, in connect_tcp
return await self._backend.connect_tcp(
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 101, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/lib/python3.9/contextlib.py", line 137, in exit
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception


Add your logs here.

@alandtse
Copy link
Owner

You don't have a network connection to Tesla. Fix that then remove and readd.

@1043717432
Copy link
Author

No way, I use Ping connection https://auth.tesla.cn The connection was successful.

The same token can also log in to teslamate

@alandtse
Copy link
Owner

I'm not here to argue with you. I'm pointing out what the logs say. You're welcome to self debug it if you know better.

@alandtse alandtse changed the title UnknownError UnknownError using tesla_custom.api Feb 11, 2022
@alandtse alandtse added the duplicate This issue or pull request already exists label Feb 11, 2022
@alandtse
Copy link
Owner

Dupe of #72. We provide no support for use of tesla_custom.api as it's a dev feature.

@aibertmark
Copy link

For use in China, please turn off any network proxy, because Tesla certification seems to detect the country where the IP is located, and Chinese users can only log in with a Chinese IP address for certification

@alandtse
Copy link
Owner

There is no network proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants