A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
Project description
opower
A Python library and command-line tool for getting historical and forecasted usage/cost data from utilities that use opower.com.
This library is used by the Opower integration in Home Assistant.
Supported Utilities
- American Electric Power (AEP) subsidiaries
- AEP Ohio
- AEP Texas
- Appalachian Power
- Indiana Michigan Power
- Kentucky Power
- Public Service Company of Oklahoma (PSO)
- Southwestern Electric Power Company (SWEPCO)
- Burbank Water and Power (BWP)
- City of Austin Utilities
- Consolidated Edison (ConEd)
- Orange & Rockland Utilities (ORU)
- Duquesne Light Company (DQE)
- Evergy
- Eversource
- Exelon subsidiaries
- Atlantic City Electric
- Baltimore Gas and Electric (BGE)
- Commonwealth Edison (ComEd)
- Delmarva Power
- PECO Energy Company (PECO)
- Potomac Electric Power Company (Pepco)
- Glendale Water and Power (GWP)
- National Grid subsidiaries
- National Grid Massachusetts
- National Grid NY Long Island
- National Grid NY Metro
- National Grid NY Upstate
- Pacific Gas & Electric (PG&E)
- Portland General Electric (PGE)
- Puget Sound Energy (PSE)
- Sacramento Municipal Utility District (SMUD)
- Seattle City Light (SCL)
- Southern Maryland Electric Cooperative (SMECO)
- Southwest Gas
Contributing
Contributions are welcome! Please feel free to submit a pull request.
Adding a New Utility
To add support for a new Opower-based utility, follow these steps:
- Verify it's an Opower utility: Use your browser's developer tools on your utility's website. If the network tab shows requests to a domain like
utility.opower.com, it's a good candidate. - Create a utility file: Add a new file in
src/opower/utilitiesthat inherits fromUtilityBase. Name the file after the utility's website (e.g.,newutility.pyfornewutility.com). - Respect scraping limitations: This library is used by Home Assistant and must adhere to its architecture rules. A headless browser cannot be a dependency, and HTML parsing is only allowed for the authentication phase.
An exception is made for the authentication phase. An integration is allowed to extract fields from forms. To make it more robust, data should not be gathered by scraping individual fields but instead scrape all fields at once.
Development environment
python3 -m venv .venv
source .venv/bin/activate
# for Windows CMD:
# .venv\Scripts\activate.bat
# for Windows PowerShell:
# .venv\Scripts\Activate.ps1
# Install dependencies
python -m pip install --upgrade pip
python -m pip install -e .
# Run pre-commit
python -m pip install pre-commit
pre-commit install
pre-commit run --all-files
# Run tests
python -m pip install -e ".[test]"
pytest
# Run command line
python -m opower --help
# To output debug logs and API responses to a file run:
python -m opower -vv 2> out.txt
# Build package
python -m pip install build
python -m build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opower-0.17.0.tar.gz.
File metadata
- Download URL: opower-0.17.0.tar.gz
- Upload date:
- Size: 50.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
409670ef14dba45bff998b4af60649f3d70ed9f9cf4b95b61f2846c6751065b9
|
|
| MD5 |
6ba6d8ad6b4c7bbb6272c55c36370561
|
|
| BLAKE2b-256 |
296165fae1ad21b86095c22c23951adcf82951af6a2e68bf743db73bb095e9a5
|
Provenance
The following attestation bundles were made for opower-0.17.0.tar.gz:
Publisher:
python-publish.yml on tronikos/opower
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opower-0.17.0.tar.gz -
Subject digest:
409670ef14dba45bff998b4af60649f3d70ed9f9cf4b95b61f2846c6751065b9 - Sigstore transparency entry: 878727743
- Sigstore integration time:
-
Permalink:
tronikos/opower@31b285de51276061f14d8a0b3435c532c7c470ca -
Branch / Tag:
refs/tags/v0.17.0 - Owner: https://github.com/tronikos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@31b285de51276061f14d8a0b3435c532c7c470ca -
Trigger Event:
release
-
Statement type:
File details
Details for the file opower-0.17.0-py3-none-any.whl.
File metadata
- Download URL: opower-0.17.0-py3-none-any.whl
- Upload date:
- Size: 67.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f7a8e699bd25c503a5a9ccaf82285f66574c5e9acec5f13aac0a5332c451a76
|
|
| MD5 |
d79b0cf4e3ba0c14cef2d759444a19cf
|
|
| BLAKE2b-256 |
297035e8817eadaeaf3b9e61cb73177cf291d1cd13e2ca8698195d7300c8db57
|
Provenance
The following attestation bundles were made for opower-0.17.0-py3-none-any.whl:
Publisher:
python-publish.yml on tronikos/opower
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opower-0.17.0-py3-none-any.whl -
Subject digest:
2f7a8e699bd25c503a5a9ccaf82285f66574c5e9acec5f13aac0a5332c451a76 - Sigstore transparency entry: 878727807
- Sigstore integration time:
-
Permalink:
tronikos/opower@31b285de51276061f14d8a0b3435c532c7c470ca -
Branch / Tag:
refs/tags/v0.17.0 - Owner: https://github.com/tronikos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@31b285de51276061f14d8a0b3435c532c7c470ca -
Trigger Event:
release
-
Statement type: