TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker or making a Paypal contribution here: paypal.me/SupportTMC

App Idea, could API be used?

Discussion in 'Model S: User Interface' started by RandyY, Sep 26, 2013.

  1. RandyY

    RandyY Member

    Joined:
    Jul 13, 2013
    Messages:
    20
    Location:
    The Woodlands, Texas, United States
    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.....
     
  2. ACDriveMotor

    ACDriveMotor Member

    Joined:
    Aug 11, 2013
    Messages:
    815
    Location:
    Seattle, WA
    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.
     
  3. brianman

    brianman Burrito Founder

    Joined:
    Nov 10, 2011
    Messages:
    15,487
    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.
     
  4. RandyY

    RandyY Member

    Joined:
    Jul 13, 2013
    Messages:
    20
    Location:
    The Woodlands, Texas, United States
    I was hoping there might a relatively simple way I could use the API and run it on my server :(
     
  5. jpasqua

    jpasqua P19325

    Joined:
    Feb 19, 2013
    Messages:
    696
    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.
     
  6. rdrcrmatt

    rdrcrmatt Member

    Joined:
    Jun 27, 2013
    Messages:
    551
    Location:
    Milwaukee
    This could be done with rest api, crontab and mailx very easily on a mac / linux box.
     
  7. jak

    jak Member

    Joined:
    Apr 20, 2013
    Messages:
    261
    Location:
    California
    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.
     
  8. brianman

    brianman Burrito Founder

    Joined:
    Nov 10, 2011
    Messages:
    15,487
    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.
     
  9. hans

    hans P631

    Joined:
    Sep 27, 2012
    Messages:
    1,123
    Location:
    Menlo Park
    #9 hans, Sep 27, 2013
    Last edited: Sep 27, 2013
    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
     

Share This Page