- Python 100%
| src/powerwall3 | ||
| .gitignore | ||
| CHANGELOG.txt | ||
| LICENSE-apache.txt | ||
| LICENSE-CC.txt | ||
| pyproject.toml | ||
| README.md | ||
Powerwall 3
Notes and code for the Tesla Powerwall 3.
Installation
Install to suit Python taste, such as:
git clone https://spacecruft.org/spacecruft/powerwall3
cd powerwall3/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .
Help
Help output:
$ powerwall3 --help
usage: powerwall3 [-h] [-a] [-b] [-d] [-g] [-i IP] [-m] [-p PASSWORD] [-r] [-s] [-t] [-v] [-V] [-w]
Powerwall 3
options:
-h, --help show this help message and exit
-a, --alerts Alerts
-b, --battery Battery level %
-d, --debug Debugging
-g, --grid Grid status
-i IP, --ip IP Powerwall 3 URL (Default 192.168.91.1)
-m, --mode Get battery operation mode
-p PASSWORD, --password PASSWORD
Powerwall 3 password
-r, --reserve Get battery reserve percentage
-s, --status Powerwall 3 status
-t, --time Get backup time remaining
-v, --verbose Increase output verbosity
-V, --version Show version
-w, --power Power data
Setup Configuration
Note, the password and IP can optionally be set in a .env file so they
don't need to be specified in the command line. Such as:
IP="192.168.1.50"
PASSWORD="foo"
Usage
Example usage.
Alerts
$ powerwall3 --alerts
['PWS_a007_MciPvIrrationalABC', 'FWUpdateSucceeded', 'SystemConnectedToGrid', 'BackfeedLimited', 'PWS_a004_MciSelfTestEF', 'PWS_a002_MciSelfTestAB', 'PWS_a041_DcRationality', 'PWS_a003_MciSelfTestCD']
Battery
$ powerwall3 --battery
45.0
Grid
$ powerwall3 --grid
UP
Battery Mode
$ powerwall3 --mode
self_consumption
Battery Reserve Percentage
$ powerwall3 --reserve
15.8
Status
$ powerwall3 --status
Site name: My Home
Firmware: 24.44.3 b968fb8e
DIN: 1707000-21-K--TG1242090024RL
Grid Power (kW): 0.423
Solar Power (kW): 3.375
Battery Power (kW): -2.64
Load Power (kW): 1.157
Battery Level %: 44.96527777777778
Status: {'command_source': 'Configuration', 'battery_target_power': 0, 'battery_target_reactive_power': 0, 'nominal_full_pack_energy': 57600, 'nominal_energy_remaining': 25900, 'max_power_energy_remaining': 0, 'max_power_energy_to_be_charged': 0, 'max_charge_power': None, 'max_discharge_power': None, 'max_apparent_power': None, 'instantaneous_max_discharge_power': 0, 'instantaneous_max_charge_power': 0, 'instantaneous_max_apparent_power': 0, 'hardware_capability_charge_power': 0, 'hardware_capability_discharge_power': 0, 'grid_services_power': None, 'system_island_state': 'SystemGridConnected', 'available_blocks': 0, 'available_charger_blocks': 0, 'battery_blocks': [], 'ffr_power_availability_high': 0, 'ffr_power_availability_low': 0, 'load_charge_constraint': 0, 'max_sustained_ramp_rate': 0, 'grid_faults': [], 'can_reboot': 'Yes', 'smart_inv_delta_p': 0, 'smart_inv_delta_q': 0, 'last_toggle_timestamp': '2023-10-13T04:08:05.957195-07:00', 'solar_real_power_limit': None, 'score': 10000, 'blocks_controlled': 0, 'primary': True, 'auxiliary_load': 0, 'all_enable_lines_high': True, 'inverter_nominal_usable_power': 0, 'expected_energy_remaining': 0}
Backtime Time Remaining
$ powerwall3 --time
20.6
Power Data
$ powerwall3 --power
Grid Power (kW): 0.26
Solar Power (kW): 2.41
Battery Power (kW): -1.49
Load Power (kW): 1.17
Network
I have a Traverse wifi router running Debian.
It has an IP on the 192.168.91.0/24 network.
The Powerwall 3 gateway has the IP 192.168.91.1 by
default.
To get to the Powerwall 3 from workstations/servers
on my network, I set up a NAT on the Traverse device.
On the workstations/servers I set up a route to the
Powerwall 3 to use the Traverse device.
Traverse
- Set up wifi on the device.
- Confirm it can ping the Powerwall 3, such as:
ping 192.168.91.1. - Add this to
/etc/sysctl.conf:
net.ipv4.ip_forward=1
net.netfilter.nf_conntrack_max = 1048576
- Add firewall rules for NAT, such as these commands:
modprobe ipt_MASQUERADE
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
Workstations / Servers
Add a route on the workstations / servers to route to the
Traverse to get to the Powerwall 3.
In /etc/network/interfaces.
The workstation/server IP is 192.168.1.5.
The workstation/server main router gateway IP is 192.168.1.1.
The Traverse IP is 192.168.1.10.
Set up such as:
auto eth0
iface eth0 inet static
address 192.168.1.5/24
gateway 192.168.1.1
# Powerwall via Traverse
up /bin/ip route add 192.168.91.0/24 via 192.168.1.10
Development
Development Install
Development install, do regular install, then run:
pip install -e .[dev]
Formatting
black src/powerwall3/main.py src/powerwall3/lib/*.py
Lint
ruff check src/
Unofficial
Unofficial project, not associated with Tesla.
Setup
In use:
-
4x Powerwall 3.
-
1x Gateway 3.
Other Unofficial Code
Other repos of note:
Powerwall 3 issues, with good info:
- https://github.com/jasonacox/Powerwall-Dashboard/issues/387
- https://github.com/jrester/tesla_powerwall
- https://github.com/Matthew1471/Tesla-API
Tesla Docs
Documentation from Tesla.
Powerwall 3 Documentation:
Powerwall 3 Owner's Manual:
Powerwall 3 Datasheet:
Powerwall 3 Installation Quick Guide:
Powerwall 3 Ethernet Connections:
Gateway 3 Datasheet:
Powerwall 3 Installation Manual with Gateway 3
Solar Roof Tiles Owner's Manual:
Solar Roof Documentation:
Warranty:
Connecting to Tesla Gateway
Of note: "For Backup Gateway 2, your password is located behind the door of the unit."
Wifi network: "'TEG-xxx,' where xxx are the last three digits of the Gateway serial number."
Logging in to web interface, it says to log in with Tesla account email address, and for password: "Backup Gateway 2: Last five digits of characters on the sticker"
URL is:
Security
Stimulant to help you raise your eyebrows:
- SSL is self signed cert, of course.
- Wifi network is public, "TEG-xxx".
License
Documentation is available under the Creative Commons Attribution-ShareAlike 4.0 International license.
Source code is available under the Apache 2.0 License.
Copyright © 2024, 2025 Jeff Moe.