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
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 greenmountainpower-0.0.6.tar.gz.
File metadata
- Download URL: greenmountainpower-0.0.6.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
889c9ebf6e66ac36b131f64a7d0a4f137f8daae7aa8731f622570e83df677ae9
|
|
| MD5 |
838876893b0b1114a72207ed352bc20a
|
|
| BLAKE2b-256 |
b947778616a06edb40aea77000c5d9c181a9b3d80ebb36da584aa98f109fed20
|
File details
Details for the file greenmountainpower-0.0.6-py3-none-any.whl.
File metadata
- Download URL: greenmountainpower-0.0.6-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72e6157da238db62bad31135780e1877dcdfa90ab60fd10f607442af9d4dc2f7
|
|
| MD5 |
955f6f7e94f666e4ab83bb4e7aca9e10
|
|
| BLAKE2b-256 |
d82f3dacd90194186609ca709ff485c4d3b652eb2304a12e78e2e88405418cfe
|