Closed peter-funktionIT closed 5 months ago
Check out the README. Once you've setup your options you then need to change OPTIONS_COMPLETE=0 to OPTIONS_COMPLETE=1 in /data/config.sh. Hopefully you can fix that and it will then progress onto the next stage
Thanks for the quick reply! I thought that I had always gotten this error, and that /data/ was never populated, but now that I verified again it had indeed been populated with a config.sh
I changed options accordingly and got it running. I had made a copy-and-paste error in nginx site-config but that was quickly handled.
Entire config flow now finished, I am still getting problems when trying to use fleet API to login to alantse's Tesla integration (v3.20.5).
All i get in the log is
2024-04-09 14:17:49.212 WARNING (MainThread) [homeassistant.config_entries] Config entry 'email@redacted.xx' for tesla_custom integration could not authenticate
I tried verifying using curl but am unsure what to enter in place of $TESLA_AUTH_TOKEN ?
curl --cacert tesla_http_proxy/selfsigned.pem --header "Authorization: Bearer $TESLA_AUTH_TOKEN" "https://raspberrypi.redacted:4430/api/1/vehicles"
{"response":null,"error":"client provided malformed OAuth token","error_description":""}
I figured curl out, the content of /data/access_token should be after Bearer in the curl command to test
curl --cacert /config/tesla_http_proxy/selfsigned.pem --header 'Authorization: Bearer xxxxxverylongstring' https://raspberrypi.redacted.se:4430/api/1/vehicles"
yields
{"response":[{"id":redacted,"vehicle_id":redacted,"vin":"redacted","color":null,"access_type":"OWNER","display_name":"Teslan","option_codes"<more output redacted>}
So far so good.
Activating debug log for the Tesla integration in Home Assistant gives more info and seems to indicate my refresh token has expired
2024-04-09 17:13:25.044 DEBUG (MainThread) [custom_components.tesla_custom.config_flow] Credentials successfully connected to the Tesla API
2024-04-09 17:13:25.050 DEBUG (MainThread) [custom_components.tesla_custom] <ssl.SSLContext object at 0x7f90e72750>
2024-04-09 17:13:25.171 DEBUG (MainThread) [teslajsonpy.controller] 552 endpoints loaded
2024-04-09 17:13:25.187 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19823 days, 6:46:35
2024-04-09 17:13:25.187 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
2024-04-09 17:13:25.187 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
2024-04-09 17:13:25.686 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token
2024-04-09 17:13:25.686 DEBUG (MainThread) [teslajsonpy.connection] Auth returned {'error': 'login_required', 'error_description': 'Login required', 'referenceID': '3d210ed7-466b-4cd6-8b6c-a820dbf24269-1712675605544'}
2024-04-09 17:13:27.176 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19823 days, 6:46:33
2024-04-09 17:13:27.177 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
2024-04-09 17:13:27.177 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
2024-04-09 17:13:27.522 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token
Obtaining a new token is listed as TODO in the docs and I was not able to get any insights at the Tesla github issue https://github.com/teslamotors/vehicle-command/issues/160
Any help?
You can get new tokens using the iOS app ‘Auth for Tesla’. Make sure you get a Fleet API token. Alternatively delete everything in /data, remove the key from your car and start again, but complete the HA registration without delay
On Tue, 9 Apr 2024 at 16:21, peter-funktionIT @.***> wrote:
I figured curl out, the content of /data/access_token should be after Bearer in the curl command to test
curl --cacert /config/tesla_http_proxy/selfsigned.pem --header 'Authorization: Bearer xxxxxverylongstring' https://raspberrypi.redacted.se:4430/api/1/vehicles"
yields
{"response":[{"id":redacted,"vehicle_id":redacted,"vin":"redacted","color":null,"access_type":"OWNER","display_name":"Teslan","option_codes"
} So far so good.
Activating debug log for the Tesla integration in Home Assistant gives more info and seems to indicate my refresh token has expired
2024-04-09 17:13:25.044 DEBUG (MainThread) [custom_components.tesla_custom.config_flow] Credentials successfully connected to the Tesla API 2024-04-09 17:13:25.050 DEBUG (MainThread) [custom_components.tesla_custom] <ssl.SSLContext object at 0x7f90e72750> 2024-04-09 17:13:25.171 DEBUG (MainThread) [teslajsonpy.controller] 552 endpoints loaded 2024-04-09 17:13:25.187 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19823 days, 6:46:35 2024-04-09 17:13:25.187 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected 2024-04-09 17:13:25.187 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token 2024-04-09 17:13:25.686 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token 2024-04-09 17:13:25.686 DEBUG (MainThread) [teslajsonpy.connection] Auth returned {'error': 'login_required', 'error_description': 'Login required', 'referenceID': '3d210ed7-466b-4cd6-8b6c-a820dbf24269-1712675605544'} 2024-04-09 17:13:27.176 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19823 days, 6:46:33 2024-04-09 17:13:27.177 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected 2024-04-09 17:13:27.177 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token 2024-04-09 17:13:27.522 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token
Obtaining a new token is listed as TODO in the docs and I was not able to get any insights at the Tesla github issue teslamotors/vehicle-command#160 https://github.com/teslamotors/vehicle-command/issues/160
Any help?
— Reply to this email directly, view it on GitHub https://github.com/iainbullock/tesla-http-proxy-docker/issues/37#issuecomment-2045462153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AODIAOJMU5ZJX7PZT3YIPDDY4QBO5AVCNFSM6AAAAABF6IPUSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBVGQ3DEMJVGM . You are receiving this because you commented.Message ID: @.***>
I deleted everything and removed 3rd party access from Tesla to start from scratch. First time I managed to paste a line-break in my proxy_url and fried my refresh_token, so started from scratch again. 2nd time I actually got it working and am now able to control my car from Home Assistant again. Thanks for your patience :+1:
I am unable to get the initial setup working, I immediately get this output when trying to run the container through docker compose:
What am I doing wrong? I think the setup for nginx in my SWAG-container should work, but I don't seem to even get to that step.
This is my docker-compose: