tronikos / opower

A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
Apache License 2.0
66 stars 59 forks source link

PSE, does not retrieve/display dollar cost billing #41

Closed fallenpegasus closed 1 year ago

fallenpegasus commented 1 year ago

PSE customer, demo can get electricity utilization, but not the actual dollar billing.

command:

python src/demo.py --verbose --utility pse --username murasakijou --password XXX --aggregate_type bill

returns (address and account#'s anonymized)

DEBUG:/home/admin/opower/src/opower/opower.py:Fetching: https://pse.opower.com/ei/edge/apis/multi-account-v1/cws/pse/customers?offset=0&batchSize=100&addressFilter= DEBUG:/home/admin/opower/src/opower/opower.py:Fetched: { "customers": [ { "id": 5677219, "uuid": "d5fdfc99-0000-11eb-b2b7-02001700b93c", "legacyOpowerId": "43-1-56a0a3", "accountNumber": "220024289999", "accountName": "123 MAIN STREET; EVERYTOWN WA 98000", "address": { "uuid": "252009d4-d7ef-11ea-b2b7-02001700b93c", "streetNumber": "123", "streetName": "MAIN STREET", "subpremise": null, "postalCode": "98000", "city": "EVERYTOWN", "country": "US", "state": "WA" }, "type": "RESIDENTIAL", "utilityAccounts": [ { "id": 7902575, "uuid": "d6df1266-0000-11eb-b2b7-02001700b93c", "utilityAccountId": "4102839998", "utilityAccountId2": null, "servicePointId": 1933642, "meterType": "ELEC", "preferredUtilityAccountId": "4102839997", "readResolution": "BILLING" }, { "id": 7902576, "uuid": "d6df1229-0000-11eb-b2b7-02001700b93c", "utilityAccountId": "4102839996", "utilityAccountId2": null, "servicePointId": 1933641, "meterType": "ELEC", "preferredUtilityAccountId": "4102839995", "readResolution": "QUARTER_HOUR" } ] } ], "offset": 0, "batchSize": 100, "total": 1 } DEBUG:/home/admin/opower/src/opower/opower.py:Fetching: https://pse.opower.com/ei/edge/apis/bill-forecast-cws-v1/cws/pse/customers/d5fdfc99-0000-11eb-b2b7-02001700b93c/combined-forecast DEBUG:/home/admin/opower/src/opower/opower.py:Fetched: { "isValidUser": true, "totalForecast": { "meterType": "COMBINED", "startDate": "2023-08-08", "endDate": "2023-09-07", "currentDate": "2023-08-18", "daysInPeriod": 31, "currentDay": 11, "daysLeftInBill": 20, "forecastedUsage": 2487, "forecastedCost": 0, "typicalUsage": 1749, "typicalCost": 0, "budgetBilling": false, "costToDate": 0, "usageToDate": 715, "currencySymbol": "$" }, "totalMetadata": [ "NO_FORECASTED_COST", "ESTIMATED_PREVIOUS_BILL" ], "accountForecasts": [ { "unitOfMeasure": "KWH", "meterType": "ELEC", "startDate": "2023-08-08", "endDate": "2023-09-07", "currentDate": "2023-08-18", "daysInPeriod": 31, "currentDay": 11, "daysLeftInBill": 20, "forecastedUsage": 2487, "typicalUsage": 1749, "budgetBilling": false, "usageToDate": 715, "currencySymbol": "$", "preferredUtilityAccountId": "4102839994", "accountUuids": [ "d6df1229-0000-11eb-b2b7-02001700b93c" ], "isSolar": false } ] }

Current bill forecast: Forecast(account=Account(customer=Customer(uuid='d5fdfc99-0000-11eb-b2b7-02001700b93c'), uuid='d6df1229-0000-11eb-b2b7-02001700b93c', utility_account_id='4102839993', meter_type=<MeterType.ELEC: 'ELEC'>, read_resolution=None), start_date=datetime.date(2023, 8, 8), end_date=datetime.date(2023, 9, 7), current_date=datetime.date(2023, 8, 18), unit_of_measure=<UnitOfMeasure.KWH: 'KWH'>, usage_to_date=715.0, cost_to_date=0.0, forecasted_usage=2487.0, forecasted_cost=0.0, typical_usage=1749.0, typical_cost=0.0)

Getting historical data: account= Account(customer=Customer(uuid='d5fdfc99-0000-11eb-b2b7-02001700b93c'), uuid='d6df1266-0000-11eb-b2b7-02001700b93c', utility_account_id='4102839992', meter_type=<MeterType.ELEC: 'ELEC'>, read_resolution=<ReadResolution.BILLING: 'BILLING'>) aggregate_type= bill start_date= 2023-08-11 20:50:26.813329 end_date= 2023-08-18 20:50:26.813356 DEBUG:/home/admin/opower/src/opower/opower.py:Fetching: https://pse.opower.com/ei/edge/apis/DataBrowser-v1/cws/cost/utilityAccount/d6df1266-0000-11eb-b2b7-02001700b93c?aggregateType=bill&startDate=2023-08-11T00%3A00%3A00-07%3A00&endDate=2023-08-19T00%3A00%3A00-07%3A00 DEBUG:/home/admin/opower/src/opower/opower.py:Fetched: { "servicePointId": "6001359992", "utilityAccountUuid": "d6df1266-0000-11eb-b2b7-02001700b93c", "unit": "KWH", "siteTimeZoneId": "America/Los_Angeles", "reads": [], "seriesComponents": null, "ratePlans": null } start_time end_time consumption provided_cost start_minus_prev_end end_minus_prev_end

Getting historical data: account= Account(customer=Customer(uuid='d5fdfc99-0000-11eb-b2b7-02001700b93c'), uuid='d6df1229-0000-11eb-b2b7-02001700b93c', utility_account_id='4102839991', meter_type=<MeterType.ELEC: 'ELEC'>, read_resolution=<ReadResolution.QUARTER_HOUR: 'QUARTER_HOUR'>) aggregate_type= bill start_date= 2023-08-11 20:50:26.813329 end_date= 2023-08-18 20:50:26.813356 DEBUG:/home/admin/opower/src/opower/opower.py:Fetching: https://pse.opower.com/ei/edge/apis/DataBrowser-v1/cws/cost/utilityAccount/d6df1229-0000-11eb-b2b7-02001700b93c?aggregateType=bill&startDate=2023-08-11T00%3A00%3A00-07%3A00&endDate=2023-08-19T00%3A00%3A00-07%3A00 DEBUG:/home/admin/opower/src/opower/opower.py:Fetched: { "servicePointId": "6001359990", "utilityAccountUuid": "d6df1229-0000-11eb-b2b7-02001700b93c", "unit": "KWH", "siteTimeZoneId": "America/Los_Angeles", "reads": [], "seriesComponents": null, "ratePlans": null } start_time end_time consumption provided_cost start_minus_prev_end end_minus_prev_end

(.venv) admin@ip-172-30-3-187:~/opower$

tronikos commented 1 year ago

At the energy dashboard at pse.com do you see dollar cost? At what aggregate type?

At https://github.com/tronikos/opower/commit/a73b047504623e5df873d277aee8a77702662f33 I added fallback to usage only data for utilities that don't provide dollar cost data but not for aggregate type of bill since I assumed all utilities provided cost at bill granularity. I guess this assumption was incorrect and we should fallback for all aggregate types.

Can you try with --aggregate_type day or hour? Do you at least get usage with cost being set to 0?

fallenpegasus commented 1 year ago

I do see the dollar cost under "My Usage". It's at the monthly bill granularity.

When I run at aggregate_type hour I get consumption but not cost Same with aggregate_type day I get no consumption and no cost with aggregate_type bill

Do you have a step by step for how I can send you the actaul pages coming from pse.com Or do a screenshare? Or I could even give you temp access to my account.

tronikos commented 1 year ago

Temp access would be easier. You can privately send it to me at discord, home assistant community forum or gmail. My username is tronikos in all of them.

fallenpegasus commented 1 year ago

msg'ed you on discord

tronikos commented 1 year ago

You last bill is from 2023-07-08 to 2023-08-08. By default demo.py is requesting data for the last 7 days so 2023-08-11 to today 2023-08-18. It's expected to not get any bill data since there aren't any. If you specify --start_date 2023-08-01 in the command line you will receive data.

eosho commented 8 months ago

@tronikos Looks like this info is starting to show up. I have Pepco in MD. I have been seeing the cost show up since the beginning of March.