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

Add Bearer Token Auth #63

Merged
merged 6 commits into from
Jan 4, 2024
Merged

Add Bearer Token Auth #63

merged 6 commits into from
Jan 4, 2024

Conversation

jasonacox
Copy link
Owner

This release adds the ability to use a Bearer Token for auth for local Powerwall gateway API calls. This is selectable by defining authmode='token' in the initialization. The default mode uses the existing AuthCookie and UserRecord method.

import pypowerwall

pw = pypowerwall.Powerwall(HOST, PASSWORD, EMAIL, TIMEZONE, authmode="token")

This could potentially help with Issue #57 (untested)

@mcbirse
Copy link
Collaborator

mcbirse commented Jan 3, 2024

Hi Jason - is it okay if I push some unrelated minor tweaks for pypowerwall as part of this PR before it gets merge? Just a thought to reduce the number of updates that need to pushed to PyPI and Docker Hub.

Mostly very minor - just to neaten up the cloud mode setup output...

@mcbirse
Copy link
Collaborator

mcbirse commented Jan 3, 2024

Oh, I did also have a thought to make a change to the "scan" option however, so that it could accept an additional argument - that being able to pass the users current host IP address.

I was thinking offering a "scan" of the users network during the setup process might be good... but as that would be run using "docker exec" and inside the container, it does not detect the correct network. Could be resolved easily by passing the current IP address of the host from the setup script and base the network detection on that instead.

@jasonacox
Copy link
Owner Author

is it okay if I push some unrelated minor tweaks for pypowerwall as part of this PR

Absolutely! Please do.

change to the "scan" option ... offering a "scan" of the users network during the setup process

That's brilliant. Yes please. I never thought of that but you are right, it would be a nice addition.

@mcbirse
Copy link
Collaborator

mcbirse commented Jan 4, 2024

Hope that small addition is okay...

I was looking at the setup script changes for Powerwall-Dashboard, and we could now include something like this to run a network scan:

docker exec -it pypowerwall python -m pypowerwall scan -ip=$(ip route get 8.8.8.8 | awk '{ print $NF }')

@jasonacox jasonacox merged commit ceabac5 into main Jan 4, 2024
24 checks passed
@jasonacox jasonacox deleted the token branch January 4, 2024 05:28
@jasonacox
Copy link
Owner Author

v0.7.4 Merged and uploaded:

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.

2 participants