Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): fixes for tesla 20.49 API changes #15

Closed

Conversation

pridkett
Copy link
Contributor

With the 20.49 firmware update by Tesla, the endpoints that previously
were open are no longer without authentication. Unfortunately, the
mechanism used for authentication is not HTTP basic, rather it's cookie
based. This makes it so a process runs in the background to ensure that
you always stay logged in and then executes the queries against the
endpoints with the login cookie.

However, for some reason cURL was just ignoring the cookie file on my
machine, so I had to do some extra hacks to make it pass the cookies in
on the command line. Also, this requires cron, which means by that point
I might as well build a new docker container for this process.

I should say - this is NOT something that I'm super proud of - in particular,
I'm really annoyed with the fix for the cookies and cURL, but it works.

Now, here's the major caveat: because most of the things have switched from
http to exec this breaks previous records in the database.

As I'm writing this, I realize there might be an approach where we can implement
a very simple proxy to make it so fewer changes are necessary.

With the 20.49 firmware update by Tesla, the endpoints that previously
were open are no longer without authentication. Unfortuantely, the
mechanism used for authentication is not HTTP basic, rather it's cookie
based. This makes it so a process runs in the background to ensure that
you always stay logged in and then executes the queries against the
endpoints with the login cookie.

However, for some reason cURL was just ignoring the cookie file on my
machine, so I had to do some extra hacks to make it pass the cookies in
on the command line. Also, this requires cron, which means by that point
I might as well build a new docker container for this process.

Fixes mihailescu2m#14

DCO 1.1 Signed-off-by: Patrick Wagstrom <[email protected]>
@pridkett
Copy link
Contributor Author

There's a good chance I'm going to be closing this PR and opening up a new one.

In short, as I was submitting this I realized that for most people switching to exec will cause them to essentially have two different data histories, which is less than ideal. It also seems generally a little hokey.

Right now I'm working on a solution that uses a lightweight proxy server to grab the cookie jar from cURL and proxy the requests through to the powerwall. This should let most of the people keep their existing data streams. Give me a day or two to get something not terrible.

@pridkett
Copy link
Contributor Author

Closing - #16 supersedes this and should be a plugin replacement for everyone.

@pridkett pridkett closed this Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant