Skip to content

mgb/tesla-powerwall-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tesla-powerwall-local

Since Tesla requires authentication to get statistics about your powerwall on your network, created a basic proxy that will automatically log in for you.

How to use

Install Go. Then go install the proxy.

go get github.com/mgb/tesla-powerwall-local/cmd/tesla-powerwall-proxy
go install github.com/mgb/tesla-powerwall-local/cmd/tesla-powerwall-proxy

At this point, you should have tesla-powerwall-proxy installed to your go bin folder (usually ~/go/bin). Execute it:

~/go/bin/tesla-powerwall-proxy --username "[email protected]" --password "gateway password" --host "192.168.0.200" --listen "localhost:8043"

You should see "Successfully logged in" message. Verify your system is operating correctly via executing:

curl https://localhost:8043/api/system_status/soe

You should see something like {"percentage":100}, showing your current battery's state of charge. If so, you have successfully started your proxy. Use whatever your system has for starting up in the background, and whatever tools you want to get json out of your powerwall.

Raspberry Pi Proxy

Setup a Raspberry Pi to proxy your Powerwall ethernet or TEG wifi to your local network. Do this by picking your favor Raspberry OS (debian/ubuntu based are easiest) and connecting a second network adapter (USB ethernet or USB Wifi). Setup your Pi so it connects to your TEG network as well as your LAN. Install the tesla-powerwall-proxy command as well as setting up the service so it starts at boot.

sudo apt install git golang-go
go install github.com/mgb/tesla-powerwall-local/cmd/tesla-powerwall-proxy@latest

sudo nano /etc/systemd/system/tesla-powerwall-proxy.service
sudo systemctl enable tesla-powerwall-proxy.service
sudo systemctl restart tesla-powerwall-proxy.service
curl https://localhost:8043/api/system_status/soe

My tesla-powerwall-proxy.service looks like the following (change [email protected] and PASSWORD to your login/password).

[Unit]
Description=Tesla Powerwall middleware, used to pull data from Tesla Gateway

[Service]
User=pi
WorkingDirectory=/home/pi/
ExecStart=/home/pi/go/bin/tesla-powerwall-proxy -h 192.168.91.1 -u [email protected] -p PASSWORD -l=:8043
Type=simple
TimeoutStopSec=10
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Multiple Powerwall hostnames

If your Powerwall is connected to your home network as well as your machine is connected to the Powerwall's wifi network, you can have the proxy attempt both (or more) hostnames to try and retrieve the data. This is useful in situations where the Powerwall may disconnect from your home network but its Wifi network is still working. To do this, add the IP address of the Powerwall as another -h in your configuration.

ExecStart=/home/pi/go/bin/tesla-powerwall-proxy -h 192.168.91.1 -h 192.168.0.7 -u [email protected] -p PASSWORD -l=:8043

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages