Bases to build mqtt daemon compatible with Home Assistant
Project description
HydroQC
Important: this project is not yet stable or fully beginner friendly. But we are working toward it!
Hydro Quebec API wrapper.
This is a package to access some functionalities of Hydro Quebec API that are not documented.
We started a discord server for the project where you can come to discuss and find help with the project : https://discord.gg/BTPDntfaXH
Documentation
Code documentation
https://hydroqc.readthedocs.io/
Architecture / concepts
If you need more information about the winter credit, the associated terms, documents, ... : Winter Credit lexicon and concepts
Credit
Thibault Cohen who wrote pyhydroquebec That's where I took most of the inspiration (and some portions of the code)
Goal
Make it easy to fetch and manipulate data from hydro quebec, especially the winter credit periods
Example folder
Two example scripts are provided in the example folder. One to fetch the raw data and return it to json with some debug and the other to publish to mqtt.
Basic setup
This uses python 3 (tested with 3.8)
- Clone the repo
git clone https://gitlab.com/hydroqc/hydroqc.git
- Create a virtual-env
$ python -m venv hydro-env
$ . hydro-env/bin/activate
(hydro-env) $ pip install -r requirements.txt
(hydro-env) $ python setup.py develop
-
Copy config/config.default.yaml to config/config.yaml and add your hydro account credentials
-
Run
example/hydro.py
Basic MQTT publisher
Configure the MQTT server information in the mqtt.py file and run it.
Will publish next winter peak event and current status to the winterpeaks topic winterpeaks/next -> next event winterpeaks/state -> current state winterpeaks/today -> periods for the current day
datetime format is YYYY-MM-DD HH:MM:SS (can be configured) and {field}_ts is unix epoch
Feel free to tinker with it to suit your needs !
Available features :
- Services.getWinterCredit() to get raw winter credit data
- Services.getTodayHourlyConsumption() to get raw hourly consumption for current day
- Services.getHourlyConsumption(date = 'YYYY-MM-DD') to get hourly consumption for specific day
- Services.getDailyConsumption(start_date = 'YYYY-MM-DD',end_date = 'YYYY-MM-DD') to get a range of daily consumption
- WinterCredit.getFutureEvents() to get a list of JSON object with future peak events
An incomplete (so far) list of possible values and their meanings are being documented here : https://hydroqc.readthedocs.io/en/latest/wintercredit/values.html
NOTES
As per issue https://github.com/zepiaf/hydroqc/issues/11 the certificate chain for service.hydroquebec.com is not downloaded correctly. It has been forced in the code. It will not be used if verification is disabled.
TODO
Project details
Release history Release notifications | RSS feed
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
Hashes for Hydro Quebec API Wrapper-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 029c0f996ab6d34cd3d0e3a01785731b80e764cb51efe6bbe604ab951c0aa6b1 |
|
MD5 | 870e67eaf5dc39b79adcca4c3fff0205 |
|
BLAKE2b-256 | 800da771f746b38a0d3fa7fb7031ccbf4c6d1344d22eda61653a45ceb8996f3b |
Hashes for Hydro_Quebec_API_Wrapper-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25f87e799a1c9f1e8fb01b3e0e00d66692f8740e1fece4a7a0ce67f7bd44a1d5 |
|
MD5 | 8067dc23ab1b4501cd19b84de49143e4 |
|
BLAKE2b-256 | 20fe95e6fefc434683dc74ac115d4cfb1c2a41fbaefc4428cfe269a6e35340fd |