opower
A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
What it is and what it does
opower is a Python library that connects to utility company websites powered by the Opower platform to retrieve your historical energy usage and cost data, plus forecasts. It wraps the authentication and API calls needed to pull this information from dozens of US utilities—including major providers like PG&E, ComEd, Exelon subsidiaries, and many regional cooperatives. The library is async-first and designed to work with Home Assistant, making it useful for home energy monitoring and automation.
The package depends on aiohttp for HTTP requests, arrow for date handling, aiozoneinfo for timezone support, and pyotp for two-factor authentication. It includes both a Python API and a command-line tool. Since utilities change their authentication and API endpoints over time, the library is actively maintained to keep up with those changes.
Use it for:
- Integrate real-time energy usage and cost forecasts into Home Assistant for home automation dashboards
- Build personal energy monitoring tools that track consumption trends across multiple utility accounts
- Automate billing alerts or notifications when forecasted costs exceed a threshold
- Export historical usage data for analysis or comparison with solar/renewable generation systems
- Feed utility data into smart home routines that adjust heating/cooling based on cost forecasts
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Fetches historical and forecasted energy usage and cost data from utility companies that use the Opower platform, supporting dozens of US utilities through their web APIs.
Yes, if you have an account with a supported US utility and want programmatic access to your usage and cost data. The library is actively maintained, has no known vulnerabilities, installs cleanly, and is purpose-built for this task. The main gotcha is that it requires Python 3.11+ and async code; if your utility isn't listed, you'd need to contribute support for it.
Install
opower on PyPI
pip
pip install opoweruv
uv add opowerpoetry
poetry add opowerInstalling opower
Before you install
Low friction install with a pure-Python wheel. Actively maintained with a recent release (19 days old) and steady commit activity. Requires Python 3.11 or later.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must retain license notices in distributions.
Quickstart
pip install opower
import asyncio
from opower import Opower
async def get_usage():
async with Opower(username='user', password='pass', utility='pge') as opower:
usage = await opower.get_historical_usage()
return usage
asyncio.run(get_usage())
Requires Python 3.11+. Async-only API; must be called within an async context.
Verify before relying
- Whether all listed utilities remain actively supported or if some have been deprecated
- Rate limits or throttling policies enforced by individual utility providers
- Data freshness guarantees (how often historical and forecast data are updated)
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — aiohttp, aiozoneinfo, arrow, pyotp |
| Maintenance | actively maintained — 19 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,163/month — #14,553 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opower-0.19.0-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
openbb-us-eiaIntegrates U.S. Energy Information…
agpl · top 15,000 on PyPI
pecoA Python library for querying the PECO outage…
permissive · top 15,000 on PyPI
electrickiwi-apiAsync Python client for the Electric Kiwi API…
copyleft · top 15,000 on PyPI
gridstatusgridstatus provides a unified Python API to…
unclear · top 15,000 on PyPI
power-grid-modelPower Grid Model is a Python/C++ library for…
copyleft · top 15,000 on PyPI
forecast-solarAsynchronous Python client for fetching solar…
permissive · top 15,000 on PyPI
pandapowerpandapower automates power system modeling,…
permissive · top 15,000 on PyPI
amberelectricProvides a Python interface to the Amber…
permissive · top 15,000 on PyPI
energyzeroAsynchronous Python client for retrieving…
permissive · top 15,000 on PyPI
sense-energyProvides Python access to the Sense Energy…
permissive · top 15,000 on PyPI