Skip to content

initial implementation for Powerwall control#110

Merged
bogosj merged 2 commits into
bogosj:mainfrom
GrimmiMeloni:energysite
Nov 16, 2023
Merged

initial implementation for Powerwall control#110
bogosj merged 2 commits into
bogosj:mainfrom
GrimmiMeloni:energysite

Conversation

@GrimmiMeloni

Copy link
Copy Markdown

This adds a minimal implementation of the Products API, used to read Tesla Energy products data. Also, adds support for a single command against Tesla Energy Sites, allowing to control the battery reserve percentage which is usually controlled via the Tesla App.

I did not add support for the entirety of the returned JSON structures, as it is rather big and contains a lot of (uninteresting?) stuff. Also, it is not clear, how Tesla slices the data. A lot of the information specific to e.g. a Powerwall is also returned partial when just listing the products.
Either way, there's room for improvements or extensions if a specific field is missing.

Caveat: I do not own a Tesla car, so I do not know if and how the products endpoint responds if you have both a car and energy products. I tried to make the implementation pretty generic, by only requiring idand resource_type in the JSON replies.
I use the presence of energy_site_id as an indicator that the given product is an energy site (and not a car).

The included example shows how to use the implemented calls to both read information for the energy site and optionally also allows to change the battery reserve percentage.

@bogosj bogosj requested a review from andig November 13, 2023 00:30
@andig

andig commented Nov 13, 2023

Copy link
Copy Markdown
Collaborator

LGTM. I'm not a big fan of embedding the client in the result, but that's what we're already doing.

@GrimmiMeloni

Copy link
Copy Markdown
Author

Can we merge this @bogosj ?

@bogosj bogosj merged commit dd2e7a7 into bogosj:main Nov 16, 2023
@bogosj

bogosj commented Nov 16, 2023

Copy link
Copy Markdown
Owner

Released as v1.2.0. Thanks!

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.

3 participants