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.
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
id
andresource_type
in the JSON replies. I use the presence ofenergy_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.