For any utility other than PG&E you are on your own.
PG&E redirects to: https://itiamping.cloud.pge.com/idp/startSSO.ping?PartnerSpId=sso.opower.com&TargetResource=https%3A%2F%2Fpge.opower.com%2Fei%2Fapp%2Fr%2Fenergy-usage-details, which if you are logged in has a single form that points to https://sso2.opower.com/sp/ACS.saml2 with 2 hidden inputs: RelayState and SAMLResponse. Then opower replies back with another form with hidden input opentoken.
Yea, I am working it out. not expecting a miracle. See if I can use your code base as a starting base to work around their walls.
Right now I see its checking for a browser.
Improve your browsing experience
You are using an older browser that may limit your access to certain features of our site. An update is recommended, but not required.
Click any of the browser icons below for a free download of the latest version.
__
You can still access our site with your current browser, but some things may not work properly, and some pages may not display correctly.
Got it. I want to continue
Let me review your browser support policy
__
Supported Browsers
* [chrome.png] Chrome 61+
* [firefox.png] Firefox 56+
* [safari.png] Safari 9+
* [edge.png] Edge 12+
* [internetexplorer.png] Internet Explorer 10+
You’re able to bypass that with https://myaccount.smud.org/?ack=true , slowly picking at it. I see you also reach a saml URL.
@tronikos do you have an article or something you can point me at that explains this pyproject.toml and setup.cfg. I have not seen this before. Will “demo.py” = [“T201”] prevent other py scripts from printing to stdout ?
As I said you are on your own on adding support for anything other than PG&E. It looks right you are on the right path. Regarding the browser I’m sure you can fix this by setting a better User-Agent in the request headers than the one I’m setting (Mozilla/5.0). Regarding the pyproject.toml and setup.cfg you can ignore them. They are for building the package and for specifying rules for the formatter and linters.
nvm, was able to do it. Turns out my base64 need to remove the line break. For people’s reference:
# the -n is important
echo -n "$CLIENT_ID:$CLIENT_SECRET" | base64 -w 0
How did you complete the API connectivity testing? I was able to upload my wildcard domain certificate from letsencrypt (*.example.com) and get their approval, but during the test (via https://api.pge.com/datacustodian/test/oauth/v2/token), it complains “Cert not present or invalid Cert” when sending the client certificate over (cert.pem and privatekey.pem).
I have installed OPower on the latest HASIO from the repo and get this error.
This error originated from a custom integration.
Logger: custom_components.opower.coordinator
Source: custom_components/opower/coordinator.py:67
Integration: Opower (documentation, issues)
First occurred: May 10, 2023 at 10:50:08 PM (335 occurrences)
Last logged: 11:28:13 AM
Unexpected error fetching Opower data: 'typicalUsage'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/opower/coordinator.py", line 67, in _async_update_data
forecasts = await self.api.async_get_forecast()
File "/usr/local/lib/python3.10/site-packages/opower/opower.py", line 226, in async_get_forecast
typical_usage=float(forecast["typicalUsage"]),
KeyError: 'typicalUsage'
I made an account on “open energy view” and linked it with my PGE account but I’m not sure if that is still necessary. When I installed the integration in HA it asked me for my PGE login and it accepted it with a successful message. I have also tested my login directly on the PGE site.
I do have 3 accounts under my PGE login so I’m not sure if that is causing the issue.
in the network requests you should see a request for combined-forecast
can you copy paste the response? Feel free to redact the values of the keys
How old is your PGE account? It’s likely for new accounts the typicalUsage is missing from the response in which case I need to handle it and not add a sensor for it.
The library now supports multiple accounts. Can you try the latest version of the integration and report whether you see data for both of your 2 service addresses?