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

investigate/incorporate as possible new Tesla Fleet API #7

Open
DarwinsDen opened this issue Jan 27, 2024 · 3 comments
Open

investigate/incorporate as possible new Tesla Fleet API #7

DarwinsDen opened this issue Jan 27, 2024 · 3 comments

Comments

@DarwinsDen
Copy link
Owner

No description provided.

@youzer-name
Copy link

I subscribe to Tessie which has an API that can be used as a drop-in replacement for the Tesla Fleet API. They just got the energy endpoints activated.

I am not a very proficient Groovy programmer, but I was thinking of trying to fork this code to see if I can add a user-selectable option to use Tessie instead of going direct to the Tesla API. The easy part would be substituting "https://api.tessie.com" for "https://api.tesla.com" and including the user's Tessie API key as the bearer token in any requests. Where I'm likely to get in over my head is if the response formats are different and require different parsing. If I can get it to work would you be interested in a PR to incorporate that into your app?

@DarwinsDen
Copy link
Owner Author

Absolutely! It would be great to have this option - particularly knowing the current Tesla API option may be going away soon. I can help if you have questions or run into issues. Hopefully looking over the Hubitat Tesla vehicle Connect app can provide some hints.

@youzer-name
Copy link

I finally found the time to take this on. I created a fork of your project and modified the tesla-powerwall-manager.groovy (app) code as best I could. I'm sure my efforts are a bit hacky, as there are a lot of subroutines that depend on validating the Tesla API token and connection.

Someone posted a comment on your website about Tesla creating an easier open-source project access to the Fleet API, so maybe in the end this won't be needed if you're able to implement that connection. But for the time being and for those with a paid Tessie account, maybe this will be useful. I'm not sure that's it's worth merging back to the base project. People who want to use Tessie can just grab the code from the fork.

I have it working on my Hubitat C7 and I'm not seeing any errors, which is a good sign. I had a rough time getting the format of the parameters for the httpAuthGet to work. It didn't look like a Tessie API issue - I was getting Groovy/Java errors on the hub when I tried to assign the value to the requestParameters. After about an hour of scratching my head I found a format that worked.

Here are a few screenshots:
I kept the status message in the same place. Since the Tessie token doesn't expire or need to be renewed it just assumes the connection is good if you choose to use Tessie. It probably needs improved error handling for if an invalid Tessie token is entered.

image

I added a page:

image

When you open that page, you can select to use Tessie and input a Tessie API key.
image

So far I've only played around with the Backup Reserve Percent settings as that's the only control I regularly use in the app.

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

No branches or pull requests

2 participants