Skip to content
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

New provider: Southern Maryland Electric COoperative (SMECO) #55

Open
sorendayton opened this issue Nov 10, 2023 · 11 comments
Open

New provider: Southern Maryland Electric COoperative (SMECO) #55

sorendayton opened this issue Nov 10, 2023 · 11 comments
Labels
enhancement New feature or request

Comments

@sorendayton
Copy link

Hi,

My provider, the Southern Maryland Electric COoperative (SMECO) uses OPOWER.

I looked through the source code for some of the other providers, and it looks like the user isn't directly using the OPOWER domain (although I am not quite tracking the subdomain use), but they are going through the utility's main website.

For example, when I am logged in, I am at a URL like:

https://dss-smcc.opower.com/dss/energy/use-details?ou-data-browser=/neighbors/electricity/year/2022-11-19?accountUuid%XXXXXXX

I have a screenshot below.

What would be the closest code to start with in trying to create something for this provider? Thanks!

Screenshot 2023-11-10 at 10 54 28 AM
@tronikos
Copy link
Owner

You best tool would be the web developer tools, network tab, in your browser. Navigate to the login page of your utility website and try to identify what endpoints you need to replicate in Python. Yours seems to use the opower domain itself which I haven't seen before.
It posts to https://dss-smcc.opower.com/webcenter/edge/apis/identity-management-v1/cws/v1/smcc/login the following:

username: test
password: test
rememberMe: true

which is easy to replicate in Python. After that without access to your account you are on your own to figure out how to get the access token for opower. For your case since you are logging in directly to opower you likely don't need any access token and just the session cookie would be enough.

@disforw
Copy link

disforw commented Dec 25, 2023

What does an access token look like? Is it named? My response has quite a few good looking options for an auth token

@tronikos
Copy link
Owner

If yours is using an access token you should be able to tell by the authorization HTTP header in requests to opower.com
It will look like https://github.com/tronikos/opower/blob/addb89460e6b578250ee5ec6ca00a5f2a40b5b0d/src/opower/opower.py#L493C22-L493C68 e.g. authorization: Bearer <access-token>

If yours is using SAML you can tell if you see a request to opower.com/sp/ACS.saml2 https://github.com/tronikos/opower/blob/addb89460e6b578250ee5ec6ca00a5f2a40b5b0d/src/opower/utilities/helpers.py#L30C34-L30C57

@disforw
Copy link

disforw commented Dec 25, 2023

Sweet! I found it.
https://login.nationalgrid.com/loginnationalgridus.onmicrosoft.com/b2c_1a_nationalgrid_convert_merge_signin/oauth2/v2.0/token returns the access_token. But theres also a “scope url” of https://login.nationalgridus.com/opower-uwp/opower
Looks the body of the request includes:
signInName=[email protected]&password=xxxxxx&Signin-forgotPassword=FORGOT_PASSWORD_FALSE&request_type=RESPONSE

the opower subdomain after my succeeded login is: ngli.opower.com
It looks like NationalGrid has many subdomains though for different areas.

what provider would you recommend I copy?

@tronikos
Copy link
Owner

Whichever you want.

@sorendayton
Copy link
Author

sorendayton commented Dec 26, 2023 via email

@disforw
Copy link

disforw commented Dec 27, 2023

@sorendayton awesome, I’m going to post my findings under a different opened thread that relates to my provider. There are othere people there that may be able to add some insight for me. Check out #45

@atx32
Copy link

atx32 commented Jan 4, 2024

@sorendayton, City of Austin Utilities also uses Opower with a similar domain: dss-coa.opower.com
I hope that any progress you make with your provider can help me as well.

@tronikos tronikos added the enhancement New feature or request label Jan 4, 2024
@sorendayton
Copy link
Author

sorendayton commented Jan 5, 2024 via email

@max2697
Copy link
Contributor

max2697 commented Jan 15, 2024

Cool, another one DSS Opower provider. Hope my changes could help with this one too. Auth flow could be different but I hope that portals are similar.

@tronikos
Copy link
Owner

tronikos commented Apr 3, 2024

@sorendayton, @max2697 refers to their #64. City of Austin Utilities also uses DSS so their implementation should hopefully help you.

@tronikos tronikos changed the title I would like to add a provider. Do you have any guidance for how? New provider: Southern Maryland Electric COoperative (SMECO) Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants