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
53 stars 49 forks source link

Add Portland General Electric PGE to utilities #44

Closed jrigling closed 9 months ago

jrigling commented 10 months ago

Hello. This PR add Portland General Electric, which is available in many parts of Oregon. Portland General is often referred to as PGE, so I just want to point out that is confusing with Pacific Gas & Electric and already used. I've use PGN here since that is the opower subdomain.

There are several "secret" keys used in the flow that I learned from another python project. They are hidden in the login page. Should this be developed like the pge.py that scrapes those from the login page?

I also need to confirm that the error conditions work properly (that failed logins produce useful error messages), but I wanted to get this draft PR in for comments.

tronikos commented 9 months ago

Will you be able to address my commends soon so that I bump the version once? I'm planning to bump it for https://github.com/tronikos/opower/pull/46

jrigling commented 9 months ago

I plan to work on this today or on the weekend.

On Tue, Sep 12, 2023, 19:38 tronikos @.***> wrote:

Will you be able to address my commends soon so that I bump the version once? I'm planning to bump it for #46 https://github.com/tronikos/opower/pull/46

— Reply to this email directly, view it on GitHub https://github.com/tronikos/opower/pull/44#issuecomment-1716856551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXRQHYOB6P4BCZBIWVRU3X2EMDVANCNFSM6AAAAAA4ODP4ME . You are receiving this because you authored the thread.Message ID: @.***>

jrigling commented 9 months ago

Comments are addressed and error messages are improved. Though I'm having trouble with the pydantic plugin for mypy.

This was tested on my Home Assistant until Sept 15 when I updated to Home Assistant Core 2023.9.2. Now it has these errors:

2023-09-16 17:56:39.240 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Portland General Electric (PGE) (username@gmail.com) for opower
File "/config/custom_components/opower/__init__.py", line 17, in async_setup_entry
coordinator = OpowerCoordinator(hass, entry.data)
File "/config/custom_components/opower/coordinator.py", line 53, in __init__
self.api = Opower(
File "/usr/local/lib/python3.11/site-packages/opower/opower.py", line 179, in __init__
File "/usr/local/lib/python3.11/site-packages/opower/opower.py", line 161, in select_utility

which seem unrelated to the work I have done.

tronikos commented 9 months ago

I'm bumping the version in https://github.com/home-assistant/core/pull/100501 Please create a virtual integration before the next monthly HA release.