jrester / tesla_powerwall

Python API for Tesla Powerwall
MIT License
73 stars 24 forks source link

Feature: Set operation mode and Backup percentage #46

Closed daniel-simpson closed 1 year ago

daniel-simpson commented 1 year ago

Was hoping to be able to set my powerwall's Operation Mode and Backup Reserve Percentage programmatically, in order to take advantage of times when power is cheap (by bumping up the backup reserve percent to pull in cheap power).

Pretty much implemented before I hit a roadblock while running integration tests though:

tesla_powerwall.error.AccessDeniedError: Access denied for resource /api/operation: Unable to POST to resource: User does not have adequate access rights

Seems that a regular user credential doesn't have access to POST to this endpoint. Have you seen this before / any way to access this endpoint? 🙏

daniel-simpson commented 1 year ago

Note: I've marked this as ready for review, but until the unauthorized issue is sorted this PR should be merged

jrester commented 1 year ago

Hey @daniel-simpson, thanks for your effort, but from my current understanding this is a wontfix. AFIK it is required to toggle some physical switch on the powerwall to enter installer mode so that one can access the operations API. You can read more about that topic here. You could maybe try to login using powerwall.login_as(User.INSTALLER, "<password>", "<email>") and see if it works this way.

daniel-simpson commented 1 year ago

Noted. I'll have a crack at logging in as an installer tomorrow, and if it doesn't look like it's going anywhere I'll close this PR myself (unless you want the reference code around?).

Thanks for the speedy response!

daniel-simpson commented 1 year ago

Closing. Definitely frustrating but it doesn't look like this will be available without a change on Tesla's side to the local API (or user permissions, at least) 😢