-
Notifications
You must be signed in to change notification settings - Fork 29
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 #16
fix(api): fixes for tesla 20.49 API changes #16
Conversation
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 brings in a very simple cookie aware proxy to run in the telegraf container. In short, cron updates the cookies every two minutes and then cookieproxy forwards to connection with cookies through to the Powerwall. Fixes mihailescu2m#14 DCO 1.1 Signed-off-by: Patrick Wagstrom <[email protected]>
@pridkett Thanks for putting this update together - I've made the changes to my existing configuration and when I run the docker-compose command the build is failing in step 5/8 when it's getting packages - the specific line is ERROR: for telegraf Cannot start service telegraf: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "/entrypoint.sh": permission denied": unknown Thanks. Nick. |
@nhallwood: The error is caused by
The line about delaying package configuration can be safely ignored - that's just what happens when you run without I'm beginning to think that the best route is probably for me to just start pushing a prebuilt |
@pridkett I'm building/running on a raspberry pi4. I've checked and none of the 3 files in that folder have execution permissions. I've added executable permissions to both .sh files. I then built the containers again (which rebuilt telegraf only) and it looks like it's running now. I will need to check that it starts updating the influxdb. After 5 minutes I'm now seeing data again in the Grafana dashboard. One thing that wasn't clear in the instructions (and I don't yet fully understand all the inner workings of the influxdb) is whether I needed to re-run all of the instructions following the command to start the docker containers. Clearly from my experience above, if you had the previous incarnation running then all you need to do is get to the "start the docker containers" command and then everything should start again. Might be worth adding a line to the md file after the start docker containers command that lets updaters know they should stop there but new builders should continue. Thanks for your help in solving this and for getting this working again! |
After a day or so cookieproxy stops responding:
Nothing obviously helpful in telegraf logs, other than connection refused errors:
|
If you kick just the How to kick just the
Obviously, this is not a complete fix, but it should get you back on track while I either integrate |
I ran cookieproxy manually for a while. The last thing logged to stdout was:
I assume this is caused by the curl cronjob creating a new cookies.txt and cookieproxy not handling that well. I've switched the cronjob to restart cookieproxy each time the cookie file changes. |
You're 100% correct on that. I used |
This looks great. What's the delay @mihailescu2m ? @pridkett are you actively using your branch? |
@nwhobart - this is a great question. I guess I could use a little bit of help here with deciding on an architectural direction. Apologies for the tome that I've written below. I've been using this branch for a little over a month - and since the bug with the open file handles was discovered, I haven't had any problems and haven't had to restart anything. I run my setup on a Raspberry Pi 4 with 4GB of RAM that also runs an overly complicated PiHole setup. Here's my dashboard for the month of March. (I don't get great performance my setup, the gable on my house runs almost straight north/south so my panels face almost nearly straight east and west.) However, why I'm not pushing for it real hard is because I'm not sure it's the correct architectural solution. I don't really like having to pull in so many other things into the From an architectural perspective I've been playing with a couple of different solutions:
I'm pretty sure that solution 4 is the best solution, I just need some time to put it together. In the mean time, this branch works fine for me and for other people (or so it seems). If people find bugs, particularly bugs with cookieproxy - like what @andrewfoster found earlier they'll get patched right up. |
I am using this branch, calling |
@nwhobart @andrewfoster @pridkett |
Hi. Trying your branch for the first time, it doesn't seem the cookie proxy is working, my
This is on RasberryPi4. I did try |
I'm going to close this in favor of #17 - which has a much cleaner implementation. In short, it adds in Cookieproxy as an independent container and requires no changes to your influxdb schema, no silliness with kicking containers because of Cookieproxy dying (docker-compose should do that), and no building of containers locally. For people with previously working setups, it should just be a matter of setting the IP address of your Powerwall and dropping your password into |
NOTE: This supersedes PR #15. The major difference between the two PRs is that using this PR will allow people to maintain their existing data streams. It creates a custom Telegraf container with a proxy running inside of it that passes the cookies through to the Powerwall. To the best of my ability, I believe this is the only way to get Telegraf to pass cookies on a request.
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 brings in a very simple cookie aware proxy to run in the
telegraf container. In short, cron updates the cookies every two minutes
and then cookieproxy forwards to connection with cookies through to the
Powerwall.
Fixes #14
DCO 1.1 Signed-off-by: Patrick Wagstrom [email protected]