Integrates your Tesla Model S/X fleet to https://slack.com
This piece of code serves as an example of how to a) integrate to Slack b) integrate to Tesla APIs. If you happen to have a fleet of shared Tesla vehicles, it will also provide information to the users of the vehicles' whereabouts.
Uses https://github.com/gutenye/tesla-api for Tesla portal integration.
I blogged about the integration at Reaktor's site: https://www.reaktor.com/blog/talking-tesla in 2014 (and an older version of this piece of software)
Node.js v12 from https://nodejs.org
The following ENV variables:
- TESLA_USERNAME - username to the Tesla portal
- TESLA_PASSWORD - password to the Tesla portal
- SLACK_RECEIVE_TOKEN - for "outgoing Slack webhooks"
- GOOGLE_API_KEY - your Google Static Maps API Key
Start it
npm start
Fetch vehicle list:
curl --data "token=<insert-SLACK_RECEIVE_TOKEN-here>&text=!tesla" http://localhost:5000/slack
Fetch vehicle battery, speed and location information:
curl --data "token=<insert-SLACK_RECEIVE_TOKEN-here>&text=!tesla <insert-vehicle-name-name>" http://localhost:5000/slack
Works nicely when deployed to Heroku Does not necessarily work (connections timeout) in Heroku since September 2020 - maybe Tesla blocked their outgoing gateway IPs ?
Point the outoing Slack webhook configuration to /slack on your Node.js instance.