BCHydroHomie API
BCHydro Python API for extracting electricity usage statistics from your personal account.
This was taken up from Eric McNeice's work here: https://github.com/emcniece/bchydro
BC Hydro seems to be making changes to break these projects.
Installation
Via PyPi:
pip install bchydrohomie
That's it! The appropriate Playwright browser will be installed automatically on first use:
- macOS: webkit (Safari-based)
- Linux: chromium
- Windows: chromium
Note: The first time you use the library (when you call a method that requires authentication), it will automatically download and install the browser binary (~100-300MB). This is a one-time download and will only take a minute. Subsequent uses will be instant.
If you prefer to pre-install the browser before using the library, you can run:
# macOS
playwright install webkit
# Linux/Windows
playwright install chromium
Via Github:
# Fetch the code
git clone https://github.com/rhude/bchydrohomie.git
cd bchydrohomie
# Set up environment
pip install -r requirements.txt
Usage
Running the example script:
pip install bchydro
export BCH_USER=your.email@domain.com
export BCH_PASS=your-bch-password
python test.py
Using in a project:
import asyncio
from bchydrohomie import BCHydroApiBrowser
async def main():
bch = BCHydroApiBrowser("username", "password")
# Asynchronous usage:
print(await bch.get_usage())
print(await bch.get_latest_point())
print(await bch.get_latest_usage())
print(await bch.get_latest_interval())
print(await bch.get_latest_cost())
# Mostly synchronous usage:
await bch.refresh()
print(bch.usage)
print(bch.latest_point)
print(bch.latest_usage)
print(bch.latest_interval)
print(bch.latest_cost)
asyncio.run(main())
⚠ Read-Only Account Sharing
This project accesses your BCHydro account as would a human in a browser. It is recommended that a read-only account is set up for use with this project for more secure operation. Using this secondary account also enables backup access in the event of account lockout.
- Read-only accounts can be configured here after logging in.
Maintenance
Dependencies can be updated with pip-tools:
# Install pip-compile and pip-sync
pip install pip-tools
# Upgrade requirements
pip-compile --upgrade
Disclaimer
This package has been developed without the express permission of BC Hydro. It accesses data by pretending to be a browser and downloading a CSV with usage data. I would be happy to work with BCHydro on a better option however they have actively been working against us, blocking previous projects.
Metadata
Release files for bchydrohomie 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bchydrohomie-1.0.0.tar.gz | 7.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bchydrohomie-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / bchydrohomie-1.0.0.tar.gz
| Download URL | bchydrohomie-1.0.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aa9cb529e78018abca355215f0ebbbb0dd54996fa62c50f9658f4020aea11ed
|
|
BLAKE2b-256 checksum How to use checksums |
6550c833a2ce54a86ec45927d473cf3c1ee8b1b489abe9f303a9b3c567fe5305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / bchydrohomie-1.0.0-py3-none-any.whl
| Download URL | bchydrohomie-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21ea9e510252694fbff72ec8fff09f111af0329cdb77252764b618fa0c2cc0d7
|
|
BLAKE2b-256 checksum How to use checksums |
89f2a4a85e5fe3e9be2427a2ffb953152a1ef43f6fdfa50bd01e51006bef795e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for bchydrohomie 1.0.0
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.