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 and becoming a Supporting Member. For more info: Support TMC

Model S REST API

Discussion in 'Model S: User Interface' started by timdorr, Feb 2, 2013.

  1. Steve Hu

    Steve Hu New Member

    Joined:
    Dec 24, 2020
    Messages:
    2
    Location:
    China Henan Zhengzhou
    #2841 Steve Hu, Dec 26, 2020
    Last edited by a moderator: Dec 26, 2020
    @SG57 Do your App has a function like Phone key for Tesla? The Tesla App has this function can make your phone(iOS or Android) become the carkey.
     
  2. Klagio

    Klagio Member

    Joined:
    Oct 24, 2020
    Messages:
    41
    Location:
    Rome, Italy
    first time I read about Teslalogger, is it better then Teslamate?
     
  3. goRt

    goRt Member

    Joined:
    Nov 22, 2016
    Messages:
    251
    Location:
    Original Hampshire ;-)
    TeslaMate is a fork of TeslaLogger, but the notice on the TM front screen has gone away now
     
  4. Florian500

    Florian500 Member

    Joined:
    Jun 10, 2020
    Messages:
    38
    Location:
    Berlin (Germany)
    Depends ;-)

    TeslaLogger has some unique features all other Loggers do not have, as far as I know.

    See the screenshots here bassmaster187/TeslaLogger
     
  5. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    Yes please!!!
     
  6. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    I have not even once gotten the wake_up command to work. How often are people posting to it, and for how long, in order to get this working? Has anyone sniffed the app traffic to verify it's using the exact same thing and what it's frequency is? I've been using postman and just manually mashing the send button for a few minutes with no results. But, if I open my phone app, it wakes up in a few seconds, so I know it's not in "deep" sleep.
     
  7. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    I don't know if this helps, but if I use my phone's streaming connection to summon my car at home, where there is both terrible cell service, and weak wifi in the garage, I often have problems and was told by Tesla service it was likely a symptom of switching connections on the car side, so you may be on to something.
     
  8. goRt

    goRt Member

    Joined:
    Nov 22, 2016
    Messages:
    251
    Location:
    Original Hampshire ;-)
    When I get a 408 back, I just wait for 15s and then loop back round - take 2-3 attempts
     
  9. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    Can I ask for the exact contents (minus token of course) of your headers? what are you using to send the command? Do you have a basic case using curl or similar that is not implemented inside a larger app?

    Here is my command, for reference (copied from Postman Console):

    Code:
    POST https://owner-api.teslamotors.com/api/1/vehicles/61123815190767109/command/wake_up
    408
    117 ms
    Network
    Request Headers
    User-Agent: Autocharger
    Authorization: Bearer !!!!!
    Accept: */*
    Postman-Token: 2b342346-8ed0-42a4-a5ca-043eebad8875
    Host: owner-api.teslamotors.com
    Accept-Encoding: gzip, deflate, br
    Connection: keep-alive
    Request Body
    Response Headers
    Date: Thu, 07 Jan 2021 05:43:58 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 106
    Connection: keep-alive
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Cache-Control: no-cache
    X-Request-Id: c37e51be1550b18b9a226a132b7ec050c37e51be1550b18b9a226a132b7ec050
    X-Runtime: 0.035559
    Strict-Transport-Security: max-age=15724800; includeSubDomains
    Response Body
    {"response":null,"error":"vehicle unavailable: {:error=>\"vehicle unavailable:\"}","error_description":""}
     
  10. goRt

    goRt Member

    Joined:
    Nov 22, 2016
    Messages:
    251
    Location:
    Original Hampshire ;-)
    I'm not using postman, I'm using teslaJS as the base hacked about by myself and called from node-red
    mseminatore/TeslaJS
     
  11. markb1

    markb1 Active Member

    Joined:
    Feb 17, 2012
    Messages:
    3,020
    Location:
    San Diego, CA
    Don't all the other endpoints wake up the car? (The exceptions are the vehicle list and the streaming API.)
     
  12. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    None of the ones I've tried (both GET and POST) will do so, although they will keep my car awake as seems to be the norm. I just can't wake up my car. Do the other endpoints in fact wake up anyone else's?
     
  13. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    The dev of teslaJS also made a windows app; it asks for "Username" and "Password (or token)". I tried a freshly generated access_token returned from https://owner-api.teslamotors.com/oauth/token, but it just sat there with a loading circle of dots forever. Is there a way to get teslaJS or the Tesla Control Windows app running without supplying the password?
     
  14. 3ngineer

    3ngineer Member

    Joined:
    Nov 26, 2019
    Messages:
    53
    Location:
    Mass
    Answer to my own question:
    install TeslaJS

    picked apart login.js, did this:
    Code:
    node
    > var token = JSON.stringify({copy and paste entire oauth/token response body here, including curly braces});
    undefined [output]
    > var fs = require('fs');
    undefined [output]
    > fs.writeFileSync('.token',token, 'utf8');
    undefined [output]
    
    then I was in business with teslaJS.

    First attempt returned
    Model 3 ( 'Autocorrect' ) is: ONLINE
    WakeUp command: Succeeded
    Vehicle state: online

    However, when checking vehicle list, it was NOT online.

    wakeup attempts from Postman didn't do anything.

    As @goRt said, a second attempt from TeslaJS actually brought it online.
     
    • Like x 1

Share This Page

  • About Us

    Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.
  • Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


    SUPPORT TMC