Closed rpeng6 closed 1 year ago
We will need debug logs to be able to tell what this is. I've never seen a 451, but it may be some restriction in China. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451
Thank you for the response, will try to get the debug log for detail support btw Teslamate is working not sure this information is useful
From: Alan Tse @.> Sent: Sunday, August 27, 2023 8:22:00 AM To: alandtse/tesla @.> Cc: rpeng6 @.>; Author @.> Subject: Re: [alandtse/tesla] Unable to Setup account for Tesla Custom Integration due to Unable to communicate with Tesla API: UNKNOWN_ERROR_451 (Issue #691)
We will need debug logs to be able to tell what this is. I've never seen a 451, but it may be some restriction in China. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451
— Reply to this email directly, view it on GitHubhttps://github.com/alandtse/tesla/issues/691#issuecomment-1694530530, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU4YC3NYQM6MESRX37EY2E3XXKHKRANCNFSM6AAAAAA32WJUU4. You are receiving this because you authored the thread.Message ID: @.***>
"/usr/local/lib/python3.11/site-packages/teslajsonpy/controller.py", line 1348, in api 2023-09-05 18:43:49.263 ERROR (MainThread) [custom_components.tesla_custom] Unable to communicate with Tesla API: UNKNOWN_ERROR_451
We will need debug logs to be able to tell what this is. I've never seen a 451, but it may be some restriction in China. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451
hi alandtse here is the debug log, seems the problem is residing in permission in accessing the website "https://owner-api.teslamotors.com/api/1/products" is there any work around or address update that needed to be made
2023-09-06 14:49:17.032 DEBUG (MainThread) [teslajsonpy.connection] Connecting with existing access token 2023-09-06 14:49:17.033 DEBUG (MainThread) [teslajsonpy.controller] 402 endpoints loaded 2023-09-06 14:49:17.034 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -6 days, 23:06:13 2023-09-06 14:49:17.034 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected 2023-09-06 14:49:17.034 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token 2023-09-06 14:49:17.582 DEBUG (MainThread) [teslajsonpy.connection] Saved new auth info {'access_token': 'token removed', 'expires_in': 1694040557} 2023-09-06 14:49:17.582 DEBUG (MainThread) [teslajsonpy.connection] Successfully refreshed oauth 2023-09-06 14:49:17.583 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-06 14:49:22.683 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-06 14:49:23.940 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:54 2023-09-06 14:49:23.940 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-06 14:49:24.177 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-06 14:49:26.873 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:51 2023-09-06 14:49:26.873 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-06 14:49:27.095 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-06 14:49:31.746 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:46 2023-09-06 14:49:31.746 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-06 14:49:32.219 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-06 14:49:32.219 ERROR (MainThread) [custom_components.tesla_custom] Unable to communicate with Tesla API: UNKNOWN_ERROR_451
If you're based in CN, you have to use the right domain. Are you using auth.tesla.cn when setting up the integration?
yes I am but I still get this error
From: Alan Tse @.> Sent: Thursday, September 7, 2023 3:54:32 PM To: alandtse/tesla @.> Cc: rpeng6 @.>; Author @.> Subject: Re: [alandtse/tesla] Unable to Setup account for Tesla Custom Integration due to Unable to communicate with Tesla API: UNKNOWN_ERROR_451 (Issue #691)
If you're based in CN, you have to use the right domain. Are you using auth.tesla.cn when setting up the integration?
— Reply to this email directly, view it on GitHubhttps://github.com/alandtse/tesla/issues/691#issuecomment-1709653788, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU4YC3NHCCWDVQUHUWRMV7LXZF4TRANCNFSM6AAAAAA32WJUU4. You are receiving this because you authored the thread.Message ID: @.***>
If you're based in CN, you have to use the right domain. Are you using auth.tesla.cn when setting up the integration?
alandtse seem the problem is at getting connection to owner-api.teslamotors.com did a little research and it seems that china based tesla need to go to "owner-api.vn.cloud.tesla.cn" so i am not sure where i can modify the original address to the correct one, below i have added the link for API and the debug log and help is highly appreciated.
https://tesla-api.timdorr.com/api-basics/authentication
debug log 2023-09-08 12:11:18.920 WARNING (MainThread) [homeassistant.config_entries] Config entry 'xx' for tesla_custom integration could not authenticate 2023-09-08 12:13:17.015 ERROR (MainThread) [custom_components.tesla_custom] Unable to communicate with Tesla API: UNKNOWN_ERROR_451 2023-09-08 12:13:42.816 DEBUG (MainThread) [teslajsonpy.controller] 402 endpoints loaded 2023-09-08 12:13:42.816 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19609 days, 11:46:18 2023-09-08 12:13:42.816 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected 2023-09-08 12:13:42.816 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token 2023-09-08 12:13:43.025 DEBUG (MainThread) [teslajsonpy.connection] Saved new auth info {'access_token': '', 'expires_in': 1694204022} 2023-09-08 12:13:43.025 DEBUG (MainThread) [teslajsonpy.connection] Successfully refreshed oauth 2023-09-08 12:13:43.025 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-08 12:13:43.780 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-08 12:13:44.923 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:59 2023-09-08 12:13:44.923 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-08 12:13:45.170 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-08 12:13:47.651 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:56 2023-09-08 12:13:47.652 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-08 12:13:47.900 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-08 12:13:52.333 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:51 2023-09-08 12:13:52.333 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-08 12:13:52.562 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-08 12:13:57.817 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in 7:59:46 2023-09-08 12:13:57.817 DEBUG (MainThread) [teslajsonpy.connection] get: https://owner-api.teslamotors.com/api/1/products {} 2023-09-08 12:13:58.536 DEBUG (MainThread) [teslajsonpy.connection] 451: {"response":null,"error":"user not allowed in region","error_description":""} 2023-09-08 12:13:58.537 ERROR (MainThread) [custom_components.tesla_custom] Unable to communicate with Tesla API: UNKNOWN_ERROR_451
@alandtse Hi alandtse seem the problem is at getting connection to owner-api.teslamotors.com did a little research and it seems that china based tesla need to go to "owner-api.vn.cloud.tesla.cn" so i am not sure where i can modify the original address to the correct one, below i have added the link for API and the debug log and help is highly appreciated.
@rpeng6 解决了吗,最后怎么做的?
@tidaybreak as this issue is closed since last year, if you still problems please open a new issue.
Dear All i am tesla user in China and currently i am trying to get my tesla to work it HA but after installation and input all the user info i am getting the error "Unable to communicate with Tesla API: UNKNOWN_ERROR_45151" i have tried changing the authentication website from .com to .cn but still does not work and give this error and help or guidance will be highly appricated.
HA system info Home Assistant 2023.8.3 Supervisor 2023.08.1 Operating System 10.5 Frontend 20230802.1 - latest
Tesla Custom Integration version:v3.15.2 log: This error originated from a custom integration.
Logger: custom_components.tesla_custom Source: custom_components/tesla_custom/init.py:195 Integration: Tesla Custom Integration (documentation, issues) First occurred: 8:55:15 AM (1 occurrences) Last logged: 8:55:15 AM
Unable to communicate with Tesla API: UNKNOWN_ERROR_451