Python API for Tesla Powerwall and Solar Power Data
MIT License
Published by jasonacox over 2 years ago
is_connected()
function to test for a successful connection to the Powerwall.python -m pypowerwall scan
)Proxy Server Updates (Build t16) - See here for more Proxy Release notes.
Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.4.0...v0.5.0
Published by jasonacox over 2 years ago
grid_status()
function to return state of grid by @wcwong in https://github.com/jasonacox/pypowerwall/pull/9
system_status()
and battery_blocks()
by @wcwong in https://github.com/jasonacox/pypowerwall/pull/10
alerts()
function to return an array of device alerts.get_reserve()
function to return battery reserve setting.pwcacheexpire
) and connection timeout
.# Force Poll
pw.poll('/api/system_status/soe',force=True)
'{"percentage":100}'
# Powerwall Alerts
pw.alerts()
['PodCommissionTime', 'GridCodesWrite', 'GridCodesWrite', 'FWUpdateSucceeded', 'THC_w155_Backup_Genealogy_Updated', 'PINV_a067_overvoltageNeutralChassis', 'THC_w155_Backup_Genealogy_Updated', 'PINV_a067_overvoltageNeutralChassis', 'PVS_a018_MciStringB', 'SYNC_a001_SW_App_Boot']
# Battery Reserve Setting
pw.get_reserve()
20.0
# State of Grid
pw.grid_status()
'UP'
Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.3.0...v0.4.0
Published by jasonacox almost 3 years ago
vitals()
output.vitals()
output for dependant systems.Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.2.0...v0.3.0
Published by jasonacox almost 3 years ago
vitals()
Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.1.4...v0.2.0
Published by jasonacox almost 3 years ago
level()
to convert the level reading to the 95% scale used by the App. This converts the battery level percentage to be consistent with the Tesla App:>>> pw.level(scale=True)
39.971429212508326
>>> pw.level()
42.972857751882906
Published by jasonacox almost 3 years ago
temp()
function to pull Powerwall temperatures.pw.temps(jsonformat=True)
{
"TETHC--2012170-25-E--TGxxxxxxxxxxxx": 17.5,
"TETHC--3012170-05-B--TGxxxxxxxxxxxx": 17.700000000000003
}
Published by jasonacox almost 3 years ago
pyPowerwall Debug
DEBUG:pypowerwall [0.1.2]
DEBUG:loaded auth from cache file .powerwall
DEBUG:Starting new HTTPS connection (1): 10.0.1.2:443
DEBUG:ERROR Timeout waiting for Powerwall API https://10.0.1.2/api/devices/vitals
Proxy Stats via http://{proxy}/stats
{"pypowerwall": "0.1.2", "gets": 2, "errors": 3, "uri": {"/stats": 1, "/soe": 1}, "ts": 1641148636, "start": 1641148618, "clear": 1641148618}
Published by jasonacox almost 3 years ago
vitals()
to pull Powerwall Vitalsstrings()
to pull data on solar panel strings (Voltage, Current, Power and State) vitals = pw.vitals(jsonformat=False)
strings = pw.strings(jsonformat=False, verbose=False)
Published by jasonacox almost 3 years ago
payload = pw.poll('/api/devices/vitals')
Published by jasonacox about 3 years ago
# Scan Network for Powerwalls
python -m pypowerwall scan
Output Example:
pyPowerwall Network Scanner [0.0.2]
Scan local network for Tesla Powerwall Gateways
Your network appears to be: 10.0.3.0/24
Enter Network or press enter to use 10.0.3.0/24:
Running Scan...
Host: 10.0.3.22 ... OPEN - Not a Powerwall
Host: 10.0.3.45 ... OPEN - Found Powerwall 1234567-00-E--TG123456789ABC
Done
Discovered 1 Powerwall Gateway
10.0.1.45 [1234567-00-E--TG123456789ABC]
Published by jasonacox about 3 years ago