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

Error in New PW Dashboard Solar Energy Year #330

Closed
aesculus opened this issue Jul 24, 2023 · 11 comments
Closed

Error in New PW Dashboard Solar Energy Year #330

aesculus opened this issue Jul 24, 2023 · 11 comments

Comments

@aesculus
Copy link

I noticed that on the graph legend that the grid mean was really low compared to solar and home. It looks like its taking the mean over the entire year vs amounts that are > 0 like home and solar are doing.

image

Also found this error when inspecting the query:

{
"request": {
"method": "GET",
"url": "api/datasources/proxy/1/query",
"params": {
"db": "powerwall",
"q": "SELECT sum("home") FROM "kwh"."http" WHERE ("home" > 0) GROUP BY time(1d) fill(null) tz('America\/Los_Angeles');SELECT sum("solar") FROM "kwh"."http" WHERE ("solar" > 0) GROUP BY time(1d) fill(0) tz('America\/Los_Angeles');SELECT sum("from_grid") - sum("to_grid") as "grid" FROM "kwh"."http" WHERE time >= now() - 24h and time <= now() GROUP BY time(1d) fill(0) tz('America\/Los_Angeles')",
"epoch": "ms"
},
"data": null,
"precision": "ms",
"hideFromInspector": false
},
"response": {
"error": "error parsing query: found \/, expected identifier, string, number, bool at line 1, char 98",
"message": "error parsing query: found \/, expected identifier, string, number, bool at line 1, char 98"
}
}

@jasonacox
Copy link
Owner

Hi @aesculus - thanks for this. Are you using this dashboard?
https://github.com/jasonacox/Powerwall-Dashboard/blob/main/dashboards/dashboard.json

I noticed that on the graph legend that the grid mean was really low compared to solar and home. It looks like its taking the mean over the entire year vs amounts that are > 0 like home and solar are doing.

Both solar and home should NOT have negative values so we remove any noise that may be caused by meters reporting negative flow. However, for grid, you need to account for negative flow because you can push energy back to the grid. The "mean" will account for this so you could potentially have a very low or even negative mean.

America\/Los_Angeles

That's a typo. The new dashboard pulls the timezone from the $tz grafana variable rather than have it hardcoded. You might check to ensure it has the right variable value set.

image

@aesculus
Copy link
Author

aesculus commented Jul 25, 2023

Makes sense on the negative values.

I am using the New dashboard but I did remove some of the PW+ panels since they are blank on my non PW+ system.

Here is my Grid Usage chart. You can see I am more of consumer and the net is way more than 863 Wh.

image

The tz variable is set the same as above which is appropriate for my area.

@jasonacox
Copy link
Owner

jasonacox commented Jul 25, 2023

Ah, I think I see what you are saying. The mean is averaging in the 0kWh days. We could add WHERE ("grid" != 0) to the query.

@aesculus
Copy link
Author

Let me know what the query should be and I can change it on the dashboard and see if it works.

This is something you would not notice if you had a full year of data since 0 would happen like never. :-)

@aesculus
Copy link
Author

BTW here is the query and number of results:

image

@jasonacox
Copy link
Owner

Ok, if we assume that we should always have either home, from_grid, or to_grid power usage data, we can use the sum of those to indicate the system is activated. You can update the query by clicking "Edit":

image

Scroll down to C and update the query to be (the updated bit is highlighted here):

image

Here is the updated query:

SELECT sum("from_grid") - sum("to_grid") as "grid" FROM "kwh"."http" WHERE ("home" + "from_grid" + "to_grid" > 0) and $timeFilter GROUP BY time(1d) fill(0) tz('$tz')

Click Apply

image

Click "Save"

image

@aesculus
Copy link
Author

aesculus commented Jul 25, 2023

Unfortunately still selecting 366 rows, most 0.

query.txt

@jasonacox
Copy link
Owner

Bummer. Thanks for the update. This may just be the way Grafana computes legend labels. The query doesn't seem to impact it. I'm not sure what try try next. If you discover anything that works, let us know!

@aesculus
Copy link
Author

aesculus commented Jul 25, 2023

Do you have a problem with this?

SELECT sum("from_grid") - sum("to_grid") as "grid" FROM "kwh"."http" WHERE $timeFilter GROUP BY time(1d) fill(null) tz('$tz')

I just changed the fill from 0 to null

image

@jasonacox
Copy link
Owner

That's brilliant! Nice job @aesculus ! I'll update the dashboard.

jasonacox added a commit that referenced this issue Jul 25, 2023
Fix mean in solar energy yr panel #330
@aesculus
Copy link
Author

Looks great. Another satisfied customer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants