Skip to main content

This is an unofficial Python client that uses the undocumented API for Green Mountain Power accounts.

Project description

Green Mountain Power

This is an unofficial Python client that uses the undocumented API for Green Mountain Power accounts.

Quickstart

To start using this client, install it using pip.

pip3 install greenmountainpower

And then import the client and use it to fetch usage data.

import datetime
import greenmountainpower

print("Collecting usage...")

gmp = greenmountainpower.api.GreenMountainPowerApi(
    account_number=58504395849, username="jsmith", password="mypassword"
)

now = datetime.datetime.now()
one_day_ago = now - datetime.timedelta(days=1)
usages = gmp.get_usage(
    precision=greenmountainpower.api.UsagePrecision.HOURLY,
    start_time=one_day_ago,
    end_time=now,
)

for usage in usages:
    print(f" - Time: {usage.start_time.isoformat()}, Usage: {usage.consumed_kwh} KWH")

Output:

Collecting usage...
 - Time: 2021-11-14T01:00:00, Usage: 0.27 KWH
 - Time: 2021-11-14T02:00:00, Usage: 0.22 KWH
 - Time: 2021-11-14T03:00:00, Usage: 0.24 KWH
 - Time: 2021-11-14T04:00:00, Usage: 0.25 KWH
 - Time: 2021-11-14T05:00:00, Usage: 0.26 KWH
 - Time: 2021-11-14T06:00:00, Usage: 0.26 KWH
 ...

Publishing

To publish a new version, follow these steps.

git tag <version> # ensure all changes are committed
python3 -m build # build the package
twine upload --repository pypi dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greenmountainpower-0.0.5.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

greenmountainpower-0.0.5-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file greenmountainpower-0.0.5.tar.gz.

File metadata

  • Download URL: greenmountainpower-0.0.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/21.6.0

File hashes

Hashes for greenmountainpower-0.0.5.tar.gz
Algorithm Hash digest
SHA256 94c6c3db7481012d087153fe39d1175a7ef503f0440d01b5ed355f09590db099
MD5 b446f739ea5cd74b1f37fe3a2723806f
BLAKE2b-256 9b0cc8336f015399b9974a5cf6fd295f821b07630a26da028749789f79214b97

See more details on using hashes here.

File details

Details for the file greenmountainpower-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for greenmountainpower-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9eab5eeaeb1f24a3982d04fca609d7d6bd3d8aa4b9b60256d4e6f3f453196dd0
MD5 4104fe5c5dd1ccdd0088a2327b6be7fb
BLAKE2b-256 25e848c2d88efadcb8cd3f39d4898fb0b0ac326348ed23d02840339dc1d1db56

See more details on using hashes here.

Supported by

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