Skip to main content

A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E

Project description

opower

PyPI Version

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) and subsidiaries
    • 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 US subsidiaries
    • National Grid Massachusetts
    • National Grid NY Long Island
    • National Grid NY Metro
    • National Grid NY Upstate
  • Northern Indiana Public Service Company (NIPSCO)
  • 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:

  1. 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.
  2. Create a utility file: Add a new file in src/opower/utilities that inherits from UtilityBase. Name the file after the utility's website (e.g., newutility.py for newutility.com).
  3. 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

opower-0.18.3.tar.gz (54.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opower-0.18.3-py3-none-any.whl (71.2 kB view details)

Uploaded Python 3

File details

Details for the file opower-0.18.3.tar.gz.

File metadata

  • Download URL: opower-0.18.3.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opower-0.18.3.tar.gz
Algorithm Hash digest
SHA256 4e01441309601c32768cacfdd651b6cdbc40c4e6a417743deadcd18117446039
MD5 7297683b7f790792d01eacecd0f04d3b
BLAKE2b-256 ebeb39663ae22cdcbd5f3b1a8af4588df0800067b9557c5b918f72257c62b4ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for opower-0.18.3.tar.gz:

Publisher: python-publish.yml on tronikos/opower

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opower-0.18.3-py3-none-any.whl.

File metadata

  • Download URL: opower-0.18.3-py3-none-any.whl
  • Upload date:
  • Size: 71.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opower-0.18.3-py3-none-any.whl
Algorithm Hash digest
SHA256 80f51206bc5f56d0cd32b0bb7645c5a0711ebcccb2f409c967a42d46e8e9c1e0
MD5 64a999d4b53ba729f21c4dd100c4c4c1
BLAKE2b-256 b5e814c65db898ba945b1abe65b955387712f325b33eda1b554f5a5566e4e61e

See more details on using hashes here.

Provenance

The following attestation bundles were made for opower-0.18.3-py3-none-any.whl:

Publisher: python-publish.yml on tronikos/opower

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page