-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requests to ComEd fail with too large of a date range #32
Comments
Can you try lowering max_request_days at https://github.com/tronikos/opower/blob/main/src/opower/opower.py#L416 ? |
It appears the max For example, I run with But if I run it with Running Here are the debug logs for day aggregate requests: `max_req = 120`/Users/brett/.virtualenvs/opower-quohth9L/bin/python /Users/brett/pcode/opower/src/demo.py --utility comed --username [email protected] --password XXX --start_date 2022-10-13T00:00:00-05:00 --end_date 2023-03-12T00:00:00-06:00 --aggregate_type day --verbose DEBUG:/Users/brett/pcode/opower/src/opower/opower.py:Fetching: https://cec.opower.com/ei/edge/apis/multi-account-v1/cws/cec/customers?offset=0&batchSize=100&addressFilter= DEBUG:/Users/brett/pcode/opower/src/opower/opower.py:Fetching: https://cec.opower.com/ei/edge/apis/bill-forecast-cws-v1/cws/cec/customers/9e967f23-9e95-11eb-bf8b-0200170058ac/combined-forecast DEBUG:/Users/brett/pcode/opower/src/opower/opower.py:Fetching: https://cec.opower.com/ei/edge/apis/DataBrowser-v1/cws/cost/utilityAccount/a3ba62b5-9e95-11eb-bf8b-0200170058ac?aggregateType=day&startDate=2022-11-13T00%3A00%3A00-06%3A00&endDate=2023-03-13T00%3A00%3A00-05%3A00 `max_req = 127`
I notice that the first request in each of these has the |
The code fetches batches backwards see https://github.com/tronikos/opower/blob/main/src/opower/opower.py#L420 so that it can terminate early when there is no more data in the past. For my PG&E account, daily and hourly data is only available for the past 3 years. If the provided date range was 10 years and since, at least for PG&E, I can request data in ~1 year ranges, going backwards we only have to make 4 requests. If we were going forward we would have to make 10 requests. |
It's strange that the max_request_days depends on the start and end date. Can you try with |
I am also having an issue with Comed. See below. I am not a programmer so I can't really tell why. The two factor is turned off and there is no other option. Logger: homeassistant.components.opower.coordinator Unexpected error fetching Opower data: 400, message='Bad Request', url=URL('https://secure.comed.com/api/Services/OpowerService.svc/GetOpowerToken') During handling of the above exception, another exception occurred: Traceback (most recent call last): |
@warren1201 your issue is different than this. Yours fail while getting the Opower access token. Most likely the request now requires Referer similar to #48 |
In reference to home-assistant/core#97814.
The HA integration requests day aggregate information from ComEd from 2022-06-13T00:00:00-05:00 to 2023-06-11T00:00:00-05:00. This fails with the following response:
Here's what I ran in the terminal:
This data is available on ComEd's website.
However, if I change the time frame with opower's demo.py, keeping the start date the same, but decreasing the end date, the request succeeds. I think that opower may be limiting the number of days for which data can be requested, and possibly may be configured per utility.
My account has been active since sometime in April/May 2021 and had a smart meter before activation.
If you'd like access to my utility account, let me know an email and I can share credentials or a HAR file of requests on ComEd's usage page with you.
The text was updated successfully, but these errors were encountered: