vloschiavo / powerwall2

Tesla Powerwall 2 - Local Gateway API documentation
Apache License 2.0
278 stars 50 forks source link

Possibility of a New Authentication Method? #55

Open rstad944 opened 2 years ago

rstad944 commented 2 years ago

I noticed in the latest Tesla Android app under Settings that there is an option to "Pair Phone to Powerwall" which requires a toggle of the PW switch.

Has anyone been able to exploit this option to pair a local controller (e.g. Raspberry Pi) to the TEG via a LAN connection?

I am especially wondering if the Powerwall mode (backup, self powered) could once again be controlled locally without using the owner-api.teslamotors.com endpoint. This local control capability had been essentially removed when the PW firmware was updated from 1.49 to 1.50.

daniel-simpson commented 1 year ago

Also keen to hear more about this! Just tried implementing a POST to /api/operation in tesla_powerwall python library repository, and it wasn't till I ran an integration test that I happened upon an access denied error, e.g.:

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

Would be fantastic to modify backup percentage via api 🙏

vloschiavo commented 1 year ago

Agree. This does sound very interesting. I'll leave this issue open until we can find a solution.

patniemeyer commented 6 months ago

I was able to make API calls to my gateway by grabbing the bearer token after logging in to the local web app (as "customer"). It only lasts for a few hours but it allows me to make calls to the /vitals endpoint.

longzheng commented 5 months ago

I was able to make API calls to my gateway by grabbing the bearer token after logging in to the local web app (as "customer"). It only lasts for a few hours but it allows me to make calls to the /vitals endpoint.

@patniemeyer Just double checking if you're still able to replicate this?

I tested using a bearer token and am still seeing a 404 for /api/devices/vitals.

GET /api/devices/vitals HTTP/1.1
Authorization: Bearer REDACTED
User-Agent: PostmanRuntime/7.36.1
Accept: */*
Host: 192.168.1.68
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Tue, 23 Jan 2024 07:37:15 GMT
Content-Length: 19

404 page not found

EDIT: Oh perhaps you're referring to a version before 23.44.0.

Sn0w3y commented 5 months ago

@longzheng as we can see it is REDACTED.

Maybe we can implement a Authentication to the Code?

Greetings