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

Any Success with 1.17.2 API Token?

Discussion in 'Tesla Energy' started by rnull, Aug 12, 2018.

  1. rnull

    rnull New Member

    Joined:
    Aug 12, 2018
    Messages:
    2
    Location:
    CA
    Hello,

    We just had our solar panels and powerwall 2 installed and I have very limited internet coverage and finding out all the things that they did not tell us with the restrictions on how to manager our system (Not Happy!). Fore example; you need to go through the app to change how you want to use the battery. This is process is terrible sometimes and takes the app minutes to update if it does at all. The installers and installation went great, but no one talked about how to access or manage the system. Tesla's post install sucks! I have found through different threads and YouTube videos bits of helpful information. I do not like that this system has to report to the mother-ship to be able to be managed. I told multiple people during the initial design that my internet is questionable. Anyway, I thought there was hope with the documented api calls from vloschiavo/powerwall2. I was looking forward to use `/api/operation` with future plans to integrate with a home automation project. All the calls work until I try to retrieve the authentication token. This has been completed on all interfaces of the Backup Gateway Wifi & LAN.

    (Based on firmware v1.17.2)

    Request:

    curl -s -i -X POST -H "Content-Type: application/json" -d '{"username":"","password":"ST123456789","force_sm_off":false}' http://192.168.xxx.xxx/api/login/Basic

    I get the following error:

    HTTP/1.1 401 Unauthorized
    Access-Control-Allow-Credentials: true
    Access-Control-Allow-Headers: X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Accept-Encoding, Authorization
    Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
    Access-Control-Allow-Origin: *
    Access-Control-Max-Age: 86400
    Content-Type: application/json
    X-Content-Type-Options: nosniff
    Date: Sun, 12 Aug 2018 15:37:28 GMT
    Content-Length: 66


    Tried from the below thread the following which changes the setting "force_sm_off":true also included the 'username":installer from another post.
    Issues with firmware v1.17.1
    Issues with firmware v1.17.1 · Issue #25 · BJReplay/PowerwallService

    I guess the real questions is what experiences do people have with the v1.17.2 or `/api/operation` ? Also notice that there is a more current version of the firmware that appears to break the api or loss of access.

    Any insight would be helpful. Thanks!
     
  2. cwied

    cwied Member

    Joined:
    Jan 13, 2015
    Messages:
    348
    Location:
    San Mateo, CA
    I initially implemented my scripts on 1.15, so 1.17 should work fine. Have you tried starting the setup wizard using a web browser? What is the content of the response you're getting back - it looks you only included the headers?

    Edit: the installer username is only needed in 1.20 and later, but since it's ignored before then, you should be ok with it.
     
  3. BJReplay

    BJReplay Member

    Joined:
    Oct 13, 2017
    Messages:
    61
    Location:
    St Kilda West
    I never had the chance to test with 1.17.x as I jumped from 1.15.3 to 1.20.0. Once I got past https issues (trusting the certificate, using a hostname that matched a SAN in the certificate) and change to login on 1.20.0 (and the fact that operation start call used to work unauthorised, but now requires auth), all working with 1.21.0. Can you log in through the GUI? Assuming you can, it might just be a matter of tweaking your CURL call. FWIW, I used Postman (Postman) to determine that I could make the API calls before coding. It's a great GUI tool for this sort of thing.
     
  4. Artimis

    Artimis Member

    Joined:
    May 31, 2018
    Messages:
    16
    Location:
    Ladera Ranch, CA
    #4 Artimis, Aug 22, 2018
    Last edited: Aug 22, 2018
    @rnull, I'm able to authenticate fine on 1.17.2. I believe the issue may be that you have "force_sm_off" set to false. I believe as of 1.17.1 this needs to be set to true. I am also using "installer" as my username instead of leaving it blank but this may have been left over from updates I had to make when I was initially upgraded to 1.21.x (and since downgraded back to to 1.17.2).

    Try flipping "force_sm_off" to true and see if that fixes your issue.

    Edit: I see at the bottom of your post that you tried this without any success.

    The only other thing I can see is that I hope you are not literally using "ST123456789" as the password. The password is unique to everyone's gateway......it is "S" followed by the serial number of your gateway which is printed on the sticker on the inside of the panel.
     
  5. rnull

    rnull New Member

    Joined:
    Aug 12, 2018
    Messages:
    2
    Location:
    CA
    Yes, I was using that password as an example and should have clarified this, but you did point me into the right direction and I messed up on my password. I was using a STB instead of a STG. Doh! I got the token now. That is what happens trying to do this late at night.

    Following Syntax worked: `curl -s -i -X POST -H "Content-Type: application/json" -d '{"username":"","password":"STG<XXXXXXXXXXX>","force_sm_off":true}' http://192.168.xxx.xxx/api/login/Basic`

    Using XXXXXXX to show SN#. I swear I checked and double checked SN#.

    I just need to take a break.

    Thank you everyone for your replies and suggestions. Hopefully know one else will use those "fat fingers".

    BJReplay - Thanks for the suggestion of Postman (Postman)

    Best Regards,

    rnull
     

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