A library to connect to Evergy's customer portal API to get electrical meter readings. Much credit goes to Lawrence Foley for the original Python Evergy client (https://github.com/lawrencefoley/evergy)
Note: This is an unofficial utility that uses Evergy's non-public API.
Previously known as "KCPL"
pip install evergypy
https://koebbe.stoplight.io/docs/evergy-portal-api/branches/main/4fe7503430702-evergy-portal-api
from evergypy import Evergy
evergy = Evergy("<username>", "<password>", "<accountnumber>", "<premiseid>")
data = evergy.get_usage()
print("Today's kWh: " + str(data[-1]["usage"]))
The last element from the get_usage()
will be the latest data. The usage
is in kilowatt-hours. I believe the peakDateTime
is the
time during that day when your usage was the highest and the peakDemand
is how many kilowatts you were drawing at that time.
Latest data:
{
'period': 'Saturday',
'billStart': '0001-01-01T00:00:00',
'billEnd': '0001-01-01T00:00:00',
'billDate': '2021-09-18T00:00:00',
'date': '9/18/2021',
'usage': 14.7756,
'demand': 3.7992,
'avgDemand': 0.0,
'peakDemand': 3.7992,
'peakDateTime': '12:45 p.m.',
'maxTemp': 71.0,
'minTemp': 71.0,
'avgTemp': 71.0,
'cost': 18.5748,
'isPartial': False
}
Work on this library is in support of a forthcoming Home Assistant integration.
- KC Water: A similar project developed by Patrick McDonagh. Check it out!
- Evergy Client: The original python client by Lawrence Foley. Thank you!
python -m pip install --upgrade virtualenv
virtualenv venv
.\venv\Scripts\activate.ps1
Install the dev dependencies and run isort
and flake8
to properly format the code.
pip install -r requirements_dev.txt
isort evergy/
flake8 evergy/
Windows PowerShell:
pip install -r docs/requirements_docs.txt
docs\make.bat clean; docs\make.bat html
- Bump
__version__
inevergy/__init__.py
git commit -m "Bump version"
git tag -a v1.0.1 -m "v1.0.1"
git push --tags
The
--no-isolation
flag tells it to use the existing virtual env
python -m build --no-isolation --wheel
twine upload --verbose --repository testpypi dist/*
twine upload --verbose --repository pypi dist/*