Closed ChrisMD123 closed 1 year ago
The date format seems fine. If you enable debug logs to you get anything useful? If you are familiar running python on the command line, could you run the demo.py of the underlying library? See https://github.com/tronikos/opower
Can you also try the failing URL in your browser after logging in to pge.com and going to the energy dashboard?
getting the same error, I try going to the URL in the error and it says {"error":{"httpStatus":401,"serviceErrorCode":"UNAUTHORIZED","details":"Expected logged in customer but received NOT_LOGGED_IN_WEB_USER"}}
I am logged into PGE prior to going to the url
tried again after opening usage stats in PGE and get this error {"error":{"httpStatus":500,"serviceErrorCode":"UPSTREAM_ERROR","details":"Could not get usage for servicePointId: xxxxxxx, customer: long-string-number."}}
So if you dont log into PGE and then go to usage details prior to loading the integration you'll get the NOT_LOGGED_IN_WEB_USER error. But after logging in and going into the usage details, you'll get the 500 internal server error. Seems that over time, it'll start giving the NOT_LOGGED_IN_WEB_USER error again until you login and go to usage again.
Logger: homeassistant.config_entries Source: config_entries.py:942 First occurred: 9:26:25 AM (1 occurrences) Last logged: 9:26:25 AM
Config entry 'Pacific Gas and Electric Company (PG&E) (email@email.com)' for opower integration not ready yet: 500, message='Internal Server Error', url=URL('https://pge.opower.com/ei/edge/apis/DataBrowser-v1/cws/cost/utilityAccount/STRING?aggregateType=bill&endDate=2020-05-05T09:26:25.234786'); Retrying in background
Same here. The issue may be related to the fact that my PG&E account didn't exist on May 5, 2020. When I change the end date to May 5, 2023, it works like a charm.
The issue is in these lines https://github.com/tronikos/opower-hacs/blob/main/custom_components/opower/coordinator.py#L177-L181 for accounts activated within the past 3 years. The code attempts to get monthly data for beginning until 3 years ago, daily for 3 years ago until 2 months ago, hourly for the past 2 months. I have to change the code to ignore errors when fetching monthly and daily data in case the account is new. In the meantime, you can manually comment out lines 179-181.
Commented out lines 179-181, restarted HA, and re-added the integration and now I get this error:
This error originated from a custom integration.
Logger: custom_components.opower.coordinator
Source: custom_components/opower/coordinator.py:182
Integration: Opower (documentation, issues)
First occurred: 3:29:01 PM (2 occurrences)
Last logged: 3:29:09 PM
Unexpected error fetching Opower data: local variable 'cost_reads' referenced before assignment
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 250, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/opower/coordinator.py", line 69, in _async_update_data
await self._insert_statistics([forecast.account for forecast in forecasts])
File "/config/custom_components/opower/coordinator.py", line 94, in _insert_statistics
cost_reads = await self._async_get_all_cost_reads(account)
File "/config/custom_components/opower/coordinator.py", line 182, in _async_get_all_cost_reads
start = end if not cost_reads else cost_reads[-1].end_time
UnboundLocalError: local variable 'cost_reads' referenced before assignment
Change line 188 to cost_reads =
instead of cost_reads +=
Sorry that won't work either. Change lines 179-181 to cost_reads = []
Sorry that won't work either. Change lines 179-181 to
cost_reads = []
so lines 177 to 180 should now just be:
start = None
end = datetime.now() - timedelta(days=3 * 365)
cost_reads = []
)
nothing else on lines 188?
Tried the above modification and when I try to add the Opower integration I get this error:
Config flow could not be loaded: {"message":"Invalid handler specified"}
Logger: homeassistant.config_entries
Source: config_entries.py:858
First occurred: 4:11:37 PM (2 occurrences)
Last logged: 4:12:18 PM
Error occurred loading flow for integration opower: Exception importing custom_components.opower.config_flow
I fixed the initially reported issue in v0.0.2
I fixed the initially reported issue in v0.0.2
Thanks, looks like everything is working!
General question: which entity should I use in the energy dashboard to track daily gas usage?
Error:
Retrying setup: 500, message='Internal Server Error', url=URL('https://pge.opower.com/ei/edge/apis/DataBrowser-v1/cws/cost/utilityAccount/[account key]?aggregateType=bill&endDate=2020-05-03T18:59:25.115077')
Note - the date is listed as 2020-05-03 - could this be the issue?