Skip to main content

PG&E Share My Data API for Self Access

This python module is a helper for the Share My Data API which allows the utility customer to download their meter data using the Energy Services Provider Interface (ESPI), part of the Green Button standard. Click here to register with PG&E as a Self Access user

Install

pip

pip install pgesmd_self_access

source

git clone https://github.com/JPHutchins/pgesmd_self_access

cd pgesmd_self_access

Virtual environment is optional but suggested if you are fiddling around:

python3 -m venv venv

source venv/bin/activate

Install the dependencies:

pip install -r requirements.txt

Access Your Data

In order to listen for messages from the PGE server you will need to provide the path to the SSL certificate (or symlink) that you provided to PGE. For example, the files (or symlinks) could be in ~/pgesmd_self_access/cert/cert.crt and ~/pgesmd_self_access/cert/private.key.

Create a file ~/pgesmd_self_access/auth/auth.json:

{
  "third_party_id" : string, from PGE - use "" if unknown
  "client_id" : string, from PGE after completing registration
  "client_secret" : string, from PGE after completing registration
  "cert_crt_path" : string, like above
  "cert_key_path" : string, like above
}

You may test some commands in the REPL to verify that everything is set up correctly:

from pgesmd_self_access.api import SelfAccessApi
pge_api = SelfAccessApi.auth( < full path to the auth.json > ) # for example, /home/jp/pgesmd_self_access/auth/auth.json
pge_api.get_service_status()

Complete the testing as required by PG&E:

from pgesmd_self_access.api import PgeRegister
pge_reg = PgeRegister() # this will look for your auth.json at ./auth/auth.json
pge_reg.complete_testing() # hopefully this succeeds - if not check the SMD Portal and auth

PGE SMD will send data to the notification URI that you specified when you registered. Login to the PGE SMD portal to change it if needed. In order to listen for the messages from PGE you will need to forward port 443 to the server that this module runs at (default) port 7999. Once it is open you can start the server:

from pgesmd_self_access.api import SelfAccessApi
from pgesmd_self_access.server import SelfAccessServer
from pgesmd_self_access.helpers import save_espi_xml
pge_api = SelfAccessApi.auth( < full path to the auth.json > )
SelfAccessServer(pge_api, save_file=save_espi_xml)

The PGE server usually takes between 10-40 seconds to package and send the message. The helper function will save the response XML in your current working directory. You may like to see helpers.parse_espi_xml for more possibilities.

Metadata

Release files for pgesmd-self-access 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgesmd-self-access 0.0.6
File Size Uploaded Provenance Actions
pgesmd_self_access-0.0.6.tar.gz 11.8 kB Without provenance Details for pgesmd_self_access-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pgesmd-self-access 0.0.6
File Interpreter ABI Platform Actions
pgesmd_self_access-0.0.6-py3-none-any.whl Python 3 none any Details for pgesmd_self_access-0.0.6-py3-none-any.whl

Total release size: 25.6 kB

Release files / pgesmd_self_access-0.0.6.tar.gz

Download URL pgesmd_self_access-0.0.6.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
25eacbde2396f34a5e2ef10e38ecd5c4054312e6c6065bcf5b3aab996fddfb74
BLAKE2b-256 checksum
How to use checksums
7f930ea1ede590568e2a8e81f9cc6bf7bab44cb0ff6691ed8feb65a00325b747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2

Release files / pgesmd_self_access-0.0.6-py3-none-any.whl

Download URL pgesmd_self_access-0.0.6-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb22ee2cdb23cb0625c8f6bb87e3d96e20bab50ac31df5ea68d910746e81e256
BLAKE2b-256 checksum
How to use checksums
c38e6a182be72d0ac2966747466089f53b252ccee2cbb65217406502b4a971e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2

Security for pgesmd-self-access 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page