Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Enable --json option #60

Merged
merged 1 commit into from
Jan 24, 2021
Merged

Conversation

np3xpu
Copy link
Contributor

@np3xpu np3xpu commented Sep 13, 2020

Hey @titilambert , thanks for the project, it's pretty useful. Figure I could contribute :)

I'm not exactly sure where you wanted to go with the --json option, but I'm guessing that you want to emulate the text output, so here is a PR. Also, for the record, fixes #58 .

Example run.:

> pyhydroquebec -H -j
2020-09-13 22:07:34,723 - WARNING - pyhydroquebec - Contract id not specified, using first available.
{"overview": {"contract_id": "312809048", "account_id": "0109436910", "customer_id": "0109436910", "balance": -116.75}, "current_period": {"period_total_bill": 15.45, "period_projection": 92.72, "period_length": 10, "period_total_days": 62, "period_mean_daily_bill": 1.55, "period_mean_daily_consumption": 15.4, "period_total_consumption": 154, "period_lower_price_consumption": 154, "period_higher_price_consumption": 0, "period_average_temperature": 16}, "current_annual_data": {"annual_mean_daily_consumption": 26.7, "annual_total_consumption": 9756, "annual_total_bill": 852.57, "annual_mean_daily_bill": 2.34, "annual_length": 365, "annual_kwh_price_cent": 8.74, "annual_date_start": "2019-09-04", "annual_date_end": "2020-09-02"}, "yesterday_data": {"date": "2020-09-12", "total_consumption": 15.94, "lower_price_consumption": 15.94, "higher_price_consumption": 0, "average_temperature": 15}, "hourly_data": [{"hour": 0, "average_temperature": 10, "lower_price_consumption": 0.14, "higher_price_consumption": 0, "total_consumption": 0.14}, {"hour": 1, "average_temperature": 9, "lower_price_consumption": 0.23, "higher_price_consumption": 0, "total_consumption": 0.23}, {"hour": 2, "average_temperature": 9, "lower_price_consumption": 0.53, "higher_price_consumption": 0, "total_consumption": 0.53}, {"hour": 3, "average_temperature": 9, "lower_price_consumption": 0.13, "higher_price_consumption": 0, "total_consumption": 0.13}, {"hour": 4, "average_temperature": 8, "lower_price_consumption": 0.24, "higher_price_consumption": 0, "total_consumption": 0.24}, {"hour": 5, "average_temperature": 8, "lower_price_consumption": 0.13, "higher_price_consumption": 0, "total_consumption": 0.13}, {"hour": 6, "average_temperature": 11, "lower_price_consumption": 0.16, "higher_price_consumption": 0, "total_consumption": 0.16}, {"hour": 7, "average_temperature": 13, "lower_price_consumption": 0.21, "higher_price_consumption": 0, "total_consumption": 0.21}, {"hour": 8, "average_temperature": 15, "lower_price_consumption": 0.58, "higher_price_consumption": 0, "total_consumption": 0.58}, {"hour": 9, "average_temperature": 15, "lower_price_consumption": 0.29, "higher_price_consumption": 0, "total_consumption": 0.29}, {"hour": 10, "average_temperature": 17, "lower_price_consumption": 0.7, "higher_price_consumption": 0, "total_consumption": 0.7}, {"hour": 11, "average_temperature": 18, "lower_price_consumption": 0.58, "higher_price_consumption": 0, "total_consumption": 0.58}, {"hour": 12, "average_temperature": 19, "lower_price_consumption": 0.89, "higher_price_consumption": 0, "total_consumption": 0.89}, {"hour": 13, "average_temperature": 19, "lower_price_consumption": 0.33, "higher_price_consumption": 0, "total_consumption": 0.33}, {"hour": 14, "average_temperature": 20, "lower_price_consumption": 0.54, "higher_price_consumption": 0, "total_consumption": 0.54}, {"hour": 15, "average_temperature": 19, "lower_price_consumption": 0.23, "higher_price_consumption": 0, "total_consumption": 0.23}, {"hour": 16, "average_temperature": 20, "lower_price_consumption": 0.21, "higher_price_consumption": 0, "total_consumption": 0.21}, {"hour": 17, "average_temperature": 19, "lower_price_consumption": 0.27, "higher_price_consumption": 0, "total_consumption": 0.27}, {"hour": 18, "average_temperature": 19, "lower_price_consumption": 2.12, "higher_price_consumption": 0, "total_consumption": 2.12}, {"hour": 19, "average_temperature": 18, "lower_price_consumption": 0.78, "higher_price_consumption": 0, "total_consumption": 0.78}, {"hour": 20, "average_temperature": 17, "lower_price_consumption": 1.95, "higher_price_consumption": 0, "total_consumption": 1.95}, {"hour": 21, "average_temperature": 16, "lower_price_consumption": 3.33, "higher_price_consumption": 0, "total_consumption": 3.33}, {"hour": 22, "average_temperature": 16, "lower_price_consumption": 0.61, "higher_price_consumption": 0, "total_consumption": 0.61}, {"hour": 23, "average_temperature": 16, "lower_price_consumption": 0.73, "higher_price_consumption": 0, "total_consumption": 0.73}]}

Sorry for the long line, don't think markdown supports new lines out of the box.

Let me know if you want something changed.

@np3xpu
Copy link
Contributor Author

np3xpu commented Nov 23, 2020

@titilambert do you still support this lib or is it dead?

@titilambert
Copy link
Owner

titilambert commented Jan 24, 2021

@np3xpu Sorry the project is kind of slow since I didn't go any answer from Hydro-Quebec to get fake/tests accounts for unit tests.
But I try to keep it up to date when I have time.

THANKS for you contribution !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

influx and json output not working
3 participants