Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

App Idea, could API be used?

This site may earn commission on affiliate links.
I'd like to have some programmable notification if the car is not plugged in. For instance, if at 11:00 PM the car isn't plugged in send an email, text message, push notification, etc to me.

Don't tell me I'm the only one that needs to plug in nightly and forgets at least once a week. Actually I have to plug in every other night, but I still like to plug in every night just to be safe. It irritates me to no end when I walk outside and see it unplugged.....
 
I think this seems like it could be relatively straightforward with the API. I don't have a car (yet) or I would write the app to try it. When my car arrives I expect I will want the same app.
When/if Tesla opens offers a "limited credentials" authentication model, people like me will consider writing apps like this.

Until then, I'm not publishing any Tesla apps because I don't want to be involved in (potentially) credentials drama.
 
I'd like to have some programmable notification if the car is not plugged in. For instance, if at 11:00 PM the car isn't plugged in send an email, text message, push notification, etc to me.

Don't tell me I'm the only one that needs to plug in nightly and forgets at least once a week. Actually I have to plug in every other night, but I still like to plug in every night just to be safe. It irritates me to no end when I walk outside and see it unplugged.....

Yes, this can be done through the API. It is easy to probe the car at a given time and determine whether it is plugged in. Someone was just asking me to add this feature to VisibleTesla. You can do it for yourself right now using one of the existing client libraries, curl, or teslams. Take a look at the REST API thread and the wiki section on APIs and apps.
 
This could be done with rest api, crontab and mailx very easily on a mac / linux box.

I was thinking the same thing. A simple Perl/Python script to make a REST call. Heck, you can probably do this with a curl call and shove it into a cronjob. Or if you're a Windows user, you can use the Windows scheduler or download the free version of System Scheduler from Splinterware to do this.

Unfortunately, I don't have a Model S yet... hopefully within a couple weeks.
 
I was hoping there might a relatively simple way I could use the API and run it on my server :(
Sorry, perhaps we have different usages of the word "apps". When I use this word with software, I think of packaged products available for sale (at a physical store, online store, etc.) not product source code that you build by yourself.
 
Using teslacmd (from the TeslaMS tools) the following Unix/Linux/Mac command line returns 1 if the car is disconnected and 0 if it is not.

Code:
teslacmd -c | grep Disconnected | wc -l

You should be able to add this into a shell script that sends an email

Code:
#!/bin/bash
SUBJECT="Charge Status"
EMAIL="[email protected]"
BODY="/tmp/emailmessage.txt"


if [ `teslacmd -c | grep Disconnected | wc -l` == 1 ] 
  then
      echo "Your Tesla is Disconnected"> $BODY
      /usr/bin/mail -s "$SUBJECT" "$EMAIL" < $BODY
  else
    echo "Connected"
fi
 
Last edited: