titilambert / pyhydroquebec

DEPRECATED - Get your consumption data from your HydroQuebec account (www.hydroquebec.com)
Apache License 2.0
94 stars 44 forks source link

Add M rate support #44

Open k-forest-hd-energy opened 4 years ago

k-forest-hd-energy commented 4 years ago

The fetch summary method cannot work when a customer object can have multiple contracts.

Here you can see an example for one of my client number. He has 2 different accounts on the same client number:

image

Also, to see the contract number you need to click on the (+) button next to "Electricité fournie à 1 adresse". This trigger an ajax request with get at https://cl-ec-spring.hydroquebec.com/portail/fr/group/clientele/gerer-mon-compte/actionAfficherLieuxDeConsoAjax?ncc=$accountNumber

The contrat number will be inside that response

Here is a stack trace of the current error:

'NoneType' object has no attribute 'text' File "/mnt/c/Users/kevmegforest/workspace/hydroquebec_puller/job/src/hydroquebec_puller/__main__.py", line 77, in main results = loop.run_until_complete(asyncio.gather(async_func)) File "/usr/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete return future.result() File "/mnt/c/Users/kevmegforest/workspace/hydroquebec_puller/job/src/env/lib/python3.7/site-packages/pyhydroquebec/__main__.py", line 65, in fetch_data_detailled_energy_use await client.login() File "/mnt/c/Users/kevmegforest/workspace/hydroquebec_puller/job/src/env/lib/python3.7/site-packages/pyhydroquebec/client.py", line 231, in login await customer.fetch_summary() File "/mnt/c/Users/kevmegforest/workspace/hydroquebec_puller/job/src/env/lib/python3.7/site-packages/pyhydroquebec/customer.py", line 61, in fetch_summary raw_contract_id = soup.find('div', {'class': 'contrat'}).text None

titilambert commented 4 years ago

Hello, This should work, I was working on my account and I add 2 contracts. Could you give me more details on your contracts ? Which contract types do you have ? D/DT/ other?

k-forest-hd-energy commented 4 years ago

It's rate M for business.

On Sat, Dec 21, 2019, 23:46 Thibault Cohen notifications@github.com wrote:

Hello, This should work, I was working on my account and I add 2 contracts. Could you give me more details on your contracts ? Which contract types do you have ? D/DT/ other?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/titilambert/pyhydroquebec/issues/44?email_source=notifications&email_token=ANV7NTUB6MGUYLEORGFYCM3QZ3WKTA5CNFSM4JK7R5RKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHPITTY#issuecomment-568232399, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANV7NTUENOL5XMZCUABXPG3QZ3WKTANCNFSM4JK7R5RA .

titilambert commented 4 years ago

I guess that's why, I never had the chance to test with a rate M :/ Let me change the title of your issue

titilambert commented 4 years ago

Unfortunately, I don't know how to test it. I would need a test account for that. But HydroQuebec didn't answer to demand (providing me some test accounts for CI)... :(

kevmegforest commented 4 years ago

Yes it can be hard to test without. I can perhaps help you with that. I have access to more than 100 clients. I should be able able to get a new mandatory letter for that specific client which have some issues. I just need that the information be kept somewhat confidential.

Send me a private message and I should be able to set it up.

kevmegforest commented 4 years ago

I guess that's why, I never had the chance to test with a rate M :/ Let me change the title of your issue

Rate M works well for me. It's only for that specific case where there are multiple contracts attached to the same client number.

I don't know what happens on the residential side for that.