Tesla Powerwall 2 Integration

OK I think I know what’s needed. Tesla have made a chance and access tokens which used to last for 45 days, now only last 8 hours. Refresh tokens still ‘appear’ to last for 45 days, so I think I need to:

  • Update the configuration to ask for a Refresh token, not an access token
  • Update the code, so that it converts the refresh token into an access token.
  • Update the remaining code to use this generated access token (rather than one from the configuration)
  • add code that checks for {“error”:“invalid bearer token”}, in which case we generate a new access token using the refresh token.

This shouldn’t be too hard, I just need a couple of clear hours. I need to fix this in the next 14 days as that’s when my current access_token will expire :slight_smile:

Edit: I something testing here, I need to wait 8 hours until the initial access token expires to know if it’s refreshing correctly.