Tesla Model S & X Script for Indigo

Posted on
Sat Jan 16, 2016 8:49 pm
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Tesla Model S & X Script for Indigo

This script pulls all of the data about a Tesla Model S & X that's available through Tesla's API and puts them into Indigo variables. I only wrote the parts that get data into Indigo. Guys much smarter than me figured out how to get access and made it available.

Before you run it, you need to create two variables (teslaUserName and teslaPassword). These credentials are used to get a token and authenticate to the server. This script uses unofficial access to the API, so it could break at any time.

I have found lots of interesting uses for the script, such as adjusting charge levels to match solar array output -- with the whole-house energy monitoring, I can make sure that I'm not buying any electricity at a high TOU period. I also have the script calculate how far the car is away from home, which potentially makes for interesting applications in turning house HVAC and lighting on and things like that.

This seems like something that would be trivial to put into a Plugin, but I burned an entire day screwing around with it and made no progress.

Code: Select all
Updated code at the end of the thread.
Last edited by Bollar on Mon Jan 18, 2016 4:40 pm, edited 1 time in total.

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sun Jan 17, 2016 8:53 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Tesla Model S & X Script for Indigo

Great! Now all I need is a Tesla. Anyone got one going spare? :D


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Sun Jan 17, 2016 8:58 am
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Re: Tesla Model S & X Script for Indigo

durosity wrote:
Great! Now all I need is a Tesla. Anyone got one going spare? :D

Come on over! You can borrow mine.

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sun Jan 17, 2016 8:59 am
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Re: Tesla Model S & X Script for Indigo

Working on a control page.

Image


Sent from my iPhone using Tapatalk

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sun Jan 17, 2016 9:01 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Tesla Model S & X Script for Indigo

durosity wrote:
Great! Now all I need is a Tesla. Anyone got one going spare? :D


Sent from my iPad using Tapatalk

Wait your turn - you already got Zoe - me first!


Sent from my iPhone using Tapatalk

Posted on
Sun Jan 17, 2016 9:04 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Tesla Model S & X Script for Indigo

howartp wrote:
durosity wrote:
Great! Now all I need is a Tesla. Anyone got one going spare? :D


Sent from my iPad using Tapatalk

Wait your turn - you already got Zoe - me first!


Sent from my iPhone using Tapatalk


If someone can give me a tesla, you can have my Zoe ;)

Also love the control page!


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Sun Jan 17, 2016 9:16 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Tesla Model S & X Script for Indigo

I'll gladly turn it into a plugin if someone will supply me with a Tesla to test with! :lol:

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jan 17, 2016 9:17 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Tesla Model S & X Script for Indigo

:)


Sent from my iPhone using Tapatalk

Posted on
Sun Jan 17, 2016 9:19 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Tesla Model S & X Script for Indigo

You'll obviously need a tester abroad to make sure it still works when you leave US as well... ;-)


Sent from my iPhone using Tapatalk

Posted on
Sun Jan 17, 2016 9:20 am
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Re: Tesla Model S & X Script for Indigo

jay (support) wrote:
I'll gladly turn it into a plugin if someone will supply me with a Tesla to test with! :lol:

Now, you're close enough that we could figure something out. :D

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sun Jan 17, 2016 9:51 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Tesla Model S & X Script for Indigo

Hey, I put my request in first, get back in line Jay! (Bloomin' Americans.. Don't know how to queue!)


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Sun Jan 17, 2016 6:54 pm
Decker offline
Posts: 22
Joined: Jun 13, 2013

Re: Tesla Model S & X Script for Indigo

Awesome work! THANK YOU.

I have been playing around with the API all day but couldn't get anywhere getting the data into Indigo. This works great.

Quick question: How often are you running the script? Since it has the"v.wake_up()" line in it will it keep the car from sleeping if I run it every 10 minutes or so?

Thanks again.

Posted on
Sun Jan 17, 2016 7:05 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Tesla Model S & X Script for Indigo

I think it is hilarious how anytime anyone hears about my home automation system that they automatically think I'm rich... when in reality, the fact that every single one of the forum users, save one, including the developers are all begging for a free tesla! Sure puts things in perspective that we're all either poor/cheap bastards :)

Posted on
Sun Jan 17, 2016 7:06 pm
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Re: Tesla Model S & X Script for Indigo

Decker wrote:
Awesome work! THANK YOU.

I have been playing around with the API all day but couldn't get anywhere getting the data into Indigo. This works great.

Quick question: How often are you running the script? Since it has the"v.wake_up()" line in it will it keep the car from sleeping if I run it every 10 minutes or so?

Thanks again.

You're welcome!

I'm running the script once a minute. The car will supposedly try to sleep after 14-15 minutes of inactivity, so you're likely keeping it awake all the time. Personally, I have my car set to be awake all the time, which does have a cost (about 2kWh / day).

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sun Jan 17, 2016 7:17 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Tesla Model S & X Script for Indigo

Dewster35 wrote:
I think it is hilarious how anytime anyone hears about my home automation system that they automatically think I'm rich... when in reality, the fact that every single one of the forum users, save one, including the developers are all begging for a free tesla! Sure puts things in perspective that we're all either poor/cheap bastards :)


Ya know my whole foray into home automation came from the simple fact that my other half leaves lights on ALL the time. Like even during the day. All i originally wanted was a simple system to turn off lights after X mins on inactivity to save money. Now speaking of money, where's my free Tesla?

Computer says no.

Who is online

Users browsing this forum: No registered users and 4 guests

cron