GithubHelp home page GithubHelp logo

jphutchins / open-energy-view Goto Github PK

View Code? Open in Web Editor NEW
70.0 70.0 11.0 39.95 MB

View resource consumption trends, history, analysis, and insights.

Home Page: https://www.openenergyview.com

License: Other

Python 23.72% Shell 1.13% HTML 0.29% JavaScript 63.63% CSS 11.23%
climate-change electricity electricity-consumption electricity-consumption-analysis electricity-consumption-forecasting electricity-meter energy energy-consumption energy-data energy-monitor home-automation iot

open-energy-view's People

Contributors

jphutchins avatar sparklerfish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-energy-view's Issues

Persistent Data Structures

Research viability of PDS to minimize bandwidth necessary for incremental updates.

Problem: User has a large database which is different to the structure in their HTML 5 local storage by perhaps 1%

Goal: Send only this 1% of data to update the user's structure rather than sending the entire structure again.

Dashboard Date defaults to December 31, 1969

Thanks for inviting me to try out Open Energy View!

Steps I've taken:
I've signed up using my Google account. After, I connected it to my PG&E Account.

Issue:
I saw that the graphs and charts weren't populated and thought it would take a some time for the data to populate. I checked a few days later and the graphs were still blank. I realized that the dates were for the year 1969 (I wasn't a customer at that point in time lol)

image

Additionally, when I go to change the date range, I only can select the year 1969:

image

Any thoughts?

Database schema

This project is becoming more complex since the user should be greeted with a flexible graph of their data.

  • User should be able to choose the date range and the interval displayed should adjust intelligently. This means that sums need to be calculated (add up all hourly intervals for a day sum, add up days for weeks, months, etc.) The question is whether this should be calculated in advance and if so what is the appropriate key to store it under in the database? The current database is keyed by a start time that is hourly - should there be other databases keyed by daily, weekly, and monthly intervals?

  • Analytics need to be implemented quickly (before Alpha) so that the user is presented with useful information that can impact a reasonable change in habits with measurable outcome.

"Simple" analytics

Goal - provide user a "baseline usage" that helps them to find "phantom power" suckers in their home. Baseline will generally be the lowest Wh recorded recently.

Daily averages.
Weekly averages.
Daily lows.
Daily highs.

More complex:
Usage characteristics:
Sleep, daytime, appliance, evening? Rely on user definition?

Stuck on spinning circle

I believe I'm having a similar issue to #46 - the same symptoms anyway. I've attached a screenshot, I'm getting a 500 error it seems.

Screenshot 2023-01-12 at 4 21 34 PM

Registration RI problem

Remove the =None s in the constructor.
Instead take a keyword method=get_auth_file argument which is the function that will provide the credentials. RI is that client_id, client_secret, cert_crt_path, cert_key_path are not None so constructor will fail of the the supplied function does not fill these class attributes. Validation can wait for later if at all.

Another 502 Bad Gateway Problem

Not sure if this should really be a new issue since it seems to be a recurring thing, but as best I can tell things seemed to have been working for others ~a week ago? I can authorize permissions with PG&E but then it gets stuck loading when it returns to the app, and if I check the console and try to look at what's going on there's a GET request receiving a 502.

502 bad gateway

After going through the PG&E authorization process without error, I am receiving a 502 bad gateway error and cannot proceed any further on Open Energy View. If I go back to my PG&E authorizations page, I do not see Open Energy View on the list.

Support gas

OEV currently does not parse gas records even though it receives them. This issue is closed when gas records are supported.

Document development environment setup

Create a new dev environment and document procedure. This should provide sample account data for 3600/900 electrical as well as gas so that the gas API can be started.

Algorithm to identify point of change in energy usage.

A user's baseline usage is given by averaging the 3 lowest readings each day. Imagine graphing this daily value over a long period of time. One is likely to see a plateaus in this graph representing periods of time where 24/7 devices remained relatively consistent. Now imagine a user has changed or added a new appliance at some point. This point should be identifiable as a change from one plateau to another. In other words, a section of the graph that has positive or negative slope relative to the sections of no slope around it. Once the point of change is identified an analysis can be delivered to the user to assess the impact on their Wh.

Frontend does not parse 900 second intervals

I lazily hardcoded the frontend to only ask the DB for intervals that match 3600 duration (1 hour). PGE has made more meters support 900 duration.

Easy fix: DB translates higher resolution intervals to 1 hour (not cool)

Better fix: Add "interval agnostic" raw data interval to the frontend and force the frontend to parse all standardized intervals from it.

export const getHourlyData = (source) => {
const email = cookie.load("logged_in");
const localStorageString = getLocalStorage(email, source);
const lastUpdate = localStorageString
? sliceLastUpdateFromResponse(localStorageString)
: null;
return attemptP(() =>
axios.post(
"/api/web/data/hours",
{ source, lastUpdate },
AuthService.getAuthHeader()
)
);
};

class GetHourlyData(Resource):
@jwt_required
def post(self):
data = get_data_parser.parse_args()
if not data["source"] or data["source"] == "None":
return
user = db.session.query(models.User).filter_by(id=get_jwt_identity()).first()
source = (
db.session.query(models.Source)
.filter_by(friendly_name=data["source"])
.with_parent(user)
.first()
)
if (data["lastUpdate"]) and (int(data["lastUpdate"]) == source.last_update):
return (
{
"useLocalStorage": True,
"email": user.email,
"friendlyName": source.friendly_name,
},
200,
)
# TODO: currently entries are coming in reversed - research ORDER BY performance
hours = (
db.session.query(models.Espi)
.filter_by(source_id=source.id, duration=3600)
.order_by(models.Espi.start)
.all()
)
database = ",".join(
[f"{entry.start//3600}{entry.watt_hours}" for entry in hours]
)
response = {
"useLocalStorage": False,
"utility": "pge",
"interval": 3600,
"email": user.email,
"friendlyName": data["source"],
"lastUpdate": source.last_update,
"partitionOptions": source.partition_options,
"database": database,
}
return response, 200

Home Assistant Integration

Your excellent OpenEnergyView project is one of the easiest ways to get programmatic access to PG&E data, especially once the gas meter support is added! PG&E's StreamMyData provides access to electricity readings (after the purchase of compatible hardware) but there seems to be no other access to the gas meter information.

It would be wonderful to have the cumulative readings available in HomeAssistant's energy dashboard (from this feature request thread).

Isolate "server"

The server (currently just server.py) should be isolated from the rest of the program and serve only one purpose :

  • Listen on 443 for the XML from PGE and upon receiving
  • open a socket to the main process and send the XML
  • and keep some of the latest XMLs so they can be retrieved RESTfully

This will allow to port the server to:

  • a WAR so that people that already have Tomcat servers can use a more secure system - ideally the webserver is on the same computer as the PGESMD service...
  • and a server in the cloud that can take in PGEs asynchronous XMLs and serve them back to users "synchronously" ... as long as they wait for PGE...

502 Bad Gateway after PG&E Auth

After authorizing PG&E I'm redirected back to https://www.openenergyview.com/api/utility/pge/redirect_uri?... but nginx shows a 502 Bad Gateway error.

Stuck on spinning circle after naming meters

Not sure if it's because my account with PGE is new, but I am unable to link my accounts and met with a spinning circle after the step you name your gas and electric meters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.