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
65 stars 59 forks source link

Feature Request: Implement near-realtime energy consumption #24

Open Sebmaster opened 1 year ago

Sebmaster commented 1 year ago

ConEd (#13) offers near-realtime (~4hr delay) energy consumption via a /usage endpoint. Request URL looks like this: https://cned.opower.com/ei/edge/apis/cws-real-time-ami-v1/cws/cned/accounts/$uuid/meters/$utilityAccountId2/usage and the request requires the regular Opower auth token. No other header trickery is required. The response body looks like this:

{
  "unit": "KWH",
  "reads": [
    {
      "startTime": "2023-08-05T03:15:00-04:00",
      "endTime": "2023-08-05T03:30:00-04:00",
      "value": 0.093
    },
    [...]
  ]
}

Not sure how applicable this is to other utilities, but might be interesting to find out if that exists. I'm a bit busy, so don't currently have plans to implement this myself. Feel free to pick this up.

rhdny commented 1 year ago

I've been following tronikos' and your efforts in this. Thanks so much for putting the time in. There are a lot of ConEd customers who will be happy!

tronikos commented 1 year ago

My utility PG&E returns: {"error":{"details":"No data returned from API."}} so I have little incentive implementing this. I'll be happy accepting any PR here and in the core integration.

rhdny commented 1 year ago

I guess it's not common across all opower utilities. It's a cool feature for at least ConEd users that gets you closer to real-time usage. Wish they would do it with gas.

akoebbe commented 1 year ago

FWIW, I tried the URL pattern @Sebmaster found for my utility (Evergy), which seems to only have information up to the previous day (at the quarter hour granularity). I got this response:

URL: https://kcpk.opower.com/ei/edge/apis/cws-real-time-ami-v1/cws/kcpk/accounts/[MyUUID]/meters/[MyutilityAccountId2]/usage

{"error":{"details":"No data returned from API. (24814820-b153-4b8d-8e97-64f4f79e5451)"}}

I'm guessing Evergy either isn't sending the data over for that or they don't have that tier of service with Oracle. :shrug:

rhdny commented 1 year ago

ConEd highlights the real-time usage feature via the UI. I'd log in and see if it's available to you as a user. If you don't see it, it may not offered for your utility.

akoebbe commented 1 year ago

Correct. There's no mention of current day usage. They used to have it via a homegrown API, but it looks like they are leaning heavily on Opower for reporting these days. Wouldn't surprise me if the utility's in-house development team was much smaller these days. I'll keep my eye on things and see if they start surfacing any real-time(ish) data on their customer portal. If they do, I'll know where to start.

ncd7 commented 10 months ago

This makes me want to learn python 😄. Is anyone looking into / working on this at the moment? It would be an amazing feature for ConEd customers...

akoebbe commented 10 months ago

@ncd7 Not to my knowledge. It would most likely need to be developed by someone with an account to a provider with real time data. Additionally, some sort of check would need to be in place (if it's not already) to the right granularity of data that's offered for each provider so that things don't break for other providers.