Cloudflare Argo Tunnel - llamafilm/tesla-http-proxy-addon GitHub Wiki
Setting up Tesla HTTP Proxy through cloudflare involves the following steps (all the steps are made with the available addons in home assistant, nothing external. Also it avoids the necessity to open ports on the router):
- Install Cloudflared addon. Then configure like this and start the addon.
external_hostname: ha.example.com
additional_hosts:
- hostname: tesla.example.com
service: https://homeassistant-internal.example.com
- Check on the Cloudflare dashboard that the two CNAME DNS Records appeared. If not read the cloudflared logs for errors.
- Create an
A
type record with namehomeassistant-internal
and IPv4 address pointing to theLOCAL IP ADDRESS
of the machine hosting the homeassistant instance. Disableproxied
. - Install Let's Encrypt addon. (can be done with other addons, check discussions on the repo for alternatives). Then configure like this and make sure to configure the
cloudflare_api_token
. Make sure thekeyfile
andcertfile
aren't already been created. If so, delete them and proceed starting the addon. Read the logs to see when the files are created (takes more than 60 seconds).
domains:
- ha.example.com
- "*.ha.example.com"
- tesla.example.com
- homeassistant-internal.example.com
email: [email protected]
keyfile: privkey.pem
certfile: fullchain.pem
challenge: dns
dns:
provider: dns-cloudflare
cloudflare_api_token: redacted
- Install SSL Proxy addon. (can be done with other addons, check discussions on the repo for alternatives). Then configure like this and make sure the paths to
certfile
andkeyfile
are correct. Start the addon. Make sure no errors appear in the logs.
domain: homeassistant-internal.example.com
hsts: max-age=31536000; includeSubDomains
certfile: fullchain.pem
keyfile: privkey.pem
cloudflare: true
customize:
active: true
default: nginx_proxy_default*.conf
servers: nginx_proxy/*.conf
-
Install Tesla HTTP Proxy addon. Configure it making sure the domain is
tesla.example.com
and then follow all the steps in theDOCS
making sure to fill theclient_id
andclient_secret
. -
Check on the Cloudflare dashboard that in the
SSL/TLS Edge Certificates
there's an active universal certificate for bothexample.com
and*.example.com
. Make sure that in theSSL/TLS Overview
page the encryption mode is set toFlexible
. -
Check your Cloudflare WAF Security to ensure that tesla.example.com is not blocked such (e.g. Geofence rules). This will cause error 403 Forbidden during oAuth generation due to public key not accessible from blocked regions. When adding key to your vehicle in the Tesla app you may get the error "Unable to Share Vehicle - This third party isn't registered with Tesla. We can't grant them access at this time." Refer to discussion topic here for details.
-
Verify that the name "homeassistant-internal.example.com" can be resolved from your local network. If it doesn't work, start of Tesla HTTP proxy will end up in a "FATAL: Fix Public Key before proceeding" error. In this case check if "DNS rebind protection" is activated in your internet access router. If it's active add "homeassistant-internal.example.com" as an exception.