This requires two components - an API.AI project (contained within one directory here), and a web server that makes appropriate queries against the Telsa API.
More project details, and a video of the project in action, can be found at http://mattdyson.org/projects/teslavoice
The web server (
VoiceResponse.py) is designed to be run as a supervisord service, and will listen for requests on
/webhook that meet the format passed by API.AI, returning an appropriately formatted response.
An additional file named Credentials.py is also required in the same directory, containing two variables -
TESLA_PASSWORD, which must match your MyTesla account
For integration with Google Home, this web server must be accessible through HTTPS (HTTP requests are not allowed).
VoiceResponse.py is set up to provide a HTTP server, so I used a separate Apache instance using ProxyPass from mod_proxy:
ProxyPass /teslawebhook http://<WEB_SERVER>:7800/webhook <Location /teslawebhook> ProxyPassReverse http://<WEB_SERVER>:7800/webhook </Location>
Insert the URL of the above web server into
apiai/agent.json in the appropriate place, then ZIP the entire folder and upload through the 'Export and Import' function found in an API.AI project.
You should then be able to publish the test version for local usage through the method described on this page to create a permanent private action on Google Home.