pypowerwall

Python API for Tesla Powerwall and Solar Power Data

MIT License

Downloads
1.4K
Stars
135
Committers
18
pypowerwall - v0.8.0 - Refactoring

Published by jasonacox 7 months ago

What's Changed

  • Refactored pyPowerwall by @emptywee in https://github.com/jasonacox/pypowerwall/pull/77 including:
  • Moved Local and Cloud based operation code into respective modules, providing better abstraction and making it easier to maintain and extend going forward.
  • Made meaning of the jsonformat parameter consistent across all method calls (breaking API change).
  • Removed Python 2.7 support.
  • Cleaned up code and adopted a more pythoinc style.
  • Fixed battery_blocks() for non-vitals systems.

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.12...v0.8.0

pypowerwall - v0.7.12 - Cachefile, Alerts & Strings

Published by jasonacox 7 months ago

What's Changed

  • Added logic to pull string data from /api/solar_powerwall API if vitals data is not available by @jasonacox in #76.
  • Added alerts from /api/solar_powerwall when vitals not present by @DerickJohnson in #75. The vitals API is not present in firmware versions > 23.44, this provides a workaround to get alerts.
  • Allow customization of the cachefile location and name by @emptywee in #74 via cachefile parameter.
# Example
import pypowerwall
pw = pypowerwall.Powerwall(
     host="10.1.2.30",
     password="secret",
     email="[email protected]",
     timezone="America/Los_Angeles",
     pwcacheexpire=5, 
     timeout=5, 
     poolmaxsize=10,
     cloudmode=False, 
     siteid=None, 
     authpath="", 
     authmode="cookie",
     cachefile=".powerwall",
     )

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.11...v0.7.12

pypowerwall - v0.7.11 - Cooldown Mode

Published by jasonacox 7 months ago

  • Updated logic to disable vitals API calls for Firmware 23.44.0+
  • Added rate limit detection and cooldown mode to allow Powerwall gateway time to recover.

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.10...v0.7.11

pypowerwall - v0.7.10 - Cache 404 Responses

Published by jasonacox 7 months ago

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.9...v0.7.10

pypowerwall - v0.7.9 - Cloud Grid Status

Published by jasonacox 8 months ago

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.8...v0.7.9

pypowerwall - v0.7.8 - Cloud Fixes

Published by jasonacox 8 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.7...v0.7.8

pypowerwall - v0.7.7 - Battery Data and Network Scanner

Published by mcbirse 9 months ago

What's Changed

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.6...v0.7.7

pypowerwall - v0.7.6 Critical Bug Fix

Published by jasonacox 10 months ago

What's Changed

🔥 CRITICAL Upgrade - Please take a moment and upgrade your installation of pypowerwall if you using it for your own scripts. The latest release fixes 404 HTTP status code handling for API calls. Older versions of pypowerwall will cause a repeating loop of login attempts eventually resulting in rate limiting and failure to get any metrics.

NOTE: IF YOU HAVE FIRMWARE 23.44.0 YOU ARE IMPACTED AND SHOULD UPGRADE AS SOON AS POSSIBLE.

pip install --upgrade pypowerwall

# Verify version 0.7.6 or greater:
python -m pypowerwall version

pyPowerwall [0.7.6]

Note: Users of pypowerwall proxy docker container should upgrade to the latest as well: jasonacox/pypowerwall:0.7.6t39

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.5...v0.7.6

pypowerwall - v0.7.5 - Cloud Mode Setup

Published by mcbirse 10 months ago

What's Changed

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.4...v0.7.5

pypowerwall - v0.7.4 - Bearer Token Auth

Published by jasonacox 10 months ago

What's Changed

  • Add Bearer Token Auth by @jasonacox in https://github.com/jasonacox/pypowerwall/pull/63
  • Powerwall Network Scanner - Added optional IP address argument to network scanner by @mcbirse in https://github.com/jasonacox/pypowerwall/pull/63. The Scan Function can now accept an additional argument -ip= to override the host IP address detection (python -m pypowerwall scan -ip=192.168.1.100). This may be useful where the host IP address/network cannot be detected correctly, for instance if pypowerwall is running inside a container.

pyPowerwall

  • This release adds the ability to use a Bearer Token for Authentication for the 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")

Proxy

  • The above option is extended to the pyPowerwall Proxy via the envrionmental variable PW_AUTH_MODE set to cookie (default) or token.

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.3...v0.7.4

pypowerwall - v0.7.3 - Cloud Mode Setup

Published by mcbirse 10 months ago

What's Changed

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.2...v0.7.3

pypowerwall - v0.7.2 - Cloud Mode Settings

Published by jasonacox 10 months ago

What's Changed

Details

This adds the option to set file path for cloud auth (.pypowerwall.auth) and site (.pypowerwall.site) cache files:

  • API - The initializer now has authpath which defaults to current directory (authpath="")
  • Proxy - An environmental variable PW_AUTH_PATH is added which defaults to current directory.

This also adds the option to specify the energy site ID (siteid):

  • API - The initializer now has siteid which defaults to None.
  • Proxy - The existing environmental variable PW_SITEID is available to set the siteid.
import pypowerwall

pw = pypowerwall.Powerwall(email="[email protected]",cloudmode=True,siteid=1234567,authpath=".auth")

This will provide more flexibility to run the pypowerwall proxy in a container for cloud mode support.

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.7.1...v0.7.2

pypowerwall - v0.7.1 - Tesla Cloud Mode

Published by jasonacox 10 months ago

What's Changed

Cloud Mode Setup - Use pypowerwall to fetch your Tesla Owners API Token

python3 -m pypowerwall setup

# Token and site information stored in .pypowerwall.auth and .pypowerwall.site

Cloud Mode Code Example

import pypowerwall

pw = pypowerwall.Powerwall(email="[email protected]",cloudmode=True)

pw.power()
# Output: {'site': 2977, 'solar': 1820, 'battery': -3860, 'load': 937}

pw.poll('/api/system_status/soe')
# Output: '{"percentage": 26.403205103271222}'

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.6.3...v0.7.1

pypowerwall - v0.6.3 - Powerwall 3 Detection

Published by jasonacox 11 months ago

What's Changed

$ python3 -m pypowerwall scan

pyPowerwall Network Scanner [0.6.3]
Scan local network for Tesla Powerwall Gateways

    Your network appears to be: 10.0.1.0/24

    Enter Network or press enter to use 10.0.1.0/24: 

    Running Scan...
      Host: 10.0.1.2 ... OPEN - Not a Powerwall
      Host: 10.0.1.5 ... OPEN - Found Powerwall 3 [Currently Unsupported]
      Host: 10.0.1.8 ... OPEN - Not a Powerwall
      Host: 10.0.1.9 ... OPEN - Found Powerwall 3 [Currently Unsupported]
      Done                           

Discovered 2 Powerwall Gateway
     10.0.1.5 [Powerwall-3] Firmware Currently Unsupported - See https://tinyurl.com/pw3support
     10.0.1.9 [Powerwall-3] Firmware Currently Unsupported - See https://tinyurl.com/pw3support

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.6.2...v0.6.3

pypowerwall - v0.6.2b - Proxy Grafana Support

Published by jasonacox about 1 year ago

What's Changed

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.6.2a...v0.6.2b

pypowerwall - v0.6.2a

Published by jasonacox about 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.6.2...v0.6.2a

pypowerwall - v0.6.2 - Proxy Cache-Control

Published by jasonacox over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.6.1...v0.6.2

pypowerwall - v0.6.1 - Add Grid Conditions

Published by jasonacox over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.6.0...v0.6.1

pypowerwall - v0.6.0 - Add Persistent HTTP Connections

Published by jasonacox over 2 years ago

What's Changed

  • PyPI 0.6.0
  • Added HTTP persistent connections for API requests to Powerwall Gateway by @mcbirse in https://github.com/jasonacox/pypowerwall/pull/21
  • Requests to Gateway will now re-use persistent http connections which reduces load and increases response time.
  • Uses default connection poolmaxsize=10 to align with Session object defaults. Note: pool use applies to multi-threaded use of pyPowerwall only, e.g. as with the pyPowerwall Proxy Server.
  • Added env PW_POOL_MAXSIZE to proxy server to allow this to be controlled (persistent connections disabled if set to zero).
  • Added env PW_TIMEOUT to proxy server to allow timeout on requests to be adjusted.

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.5.1...v0.6.0

pypowerwall - v0.5.1 - Fix grid_status() Off-Grid Map

Published by jasonacox over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/jasonacox/pypowerwall/compare/v0.5.0...v0.5.1