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

New Provider: FirstEnergy and subsidiaries #67

Open micle546 opened 10 months ago

micle546 commented 10 months ago

FirstEnergy and it's subsidiaries are using opower. Creating this issue to support the addition of FirstEnergy.

I've done some of the initial work to support this. Will continue over the course of the next few days

login page - https://www.firstenergycorp.com/content/customer/log_in.html or https://www.firstenergycorp.com/log_in.fecorplogin.html

https://www.firstenergycorp.com/my_account/analyze-usage.html

First Energy: Ohio Edison uses feoe.opower.com

Others appear to be: (need verified) (?) https://fepa.opower.com/ MetEd(?) - https://feme.opower.com/ PennPower (?) - https://fepp.opower.com/ (?) - https://fepn.opower.com/ ToledoEdison (?) - https://fete.opower.com/

micle546 commented 10 months ago

I think it's returned as an oauth bearer token? (not a webdev) POST to https://www.firstenergycorp.com/log_in.fecorplogin.html

login:<USERNAME>
password:<PASSWORD>

Response from https://www.firstenergycorp.com/my_account/analyze-usage.html?cache=no

<script>
var currentWidgetOpco = 'FEOE';

window.addEventListener('opower:unauthorized', function(event) {
  var authorize = event.detail.authorize;
  var authorization = {
   accessToken: '<TOKEN>'
  }
  authorize(null, authorization); // Do not call if user is logged out
});

Used with GET

authorization: Bearer <TOKEN>
opower-selected-entities: ["urn:opower:customer:uuid:<UUID>"]
micle546 commented 10 months ago

If I POST the login and passwd to the log_in.html page, I should just be able to GET the analyze-usage.html page to pull the bearer token after some specified waiting period for processing, right?

I'm mostly stumbling in the dark here.

Done some python, but never any web stuff, particularly with async/await threading.