I’m currently creating a Dashboard to visualize my solar generation, how much energy comes from the grid and how much my total power consumption is groued by day for the last 90 days.
The solar generation and the grid consumption are done, because these values I have as total kWh from my energy meter. I initially used a transformation to calculate the power consumption, but the values were incorrect, because i can’t use my solar power completely: approx 50 % are send to the grid.
The attached image show the expected diagram, but the total consumption must be lower
This is the query i used for solar and from the grid
SELECT
$__unixEpochGroupAlias(ts_sec,1d,0),
avg(val) - lag(avg(val)) OVER (ORDER BY $__unixEpochGroup(ts_sec,1d,0)) AS "From Grid"
FROM ts_number
WHERE
ts_sec >= $__unixEpochFrom() and ts_sec <= $__unixEpochTo() and id = 2
GROUP BY 1
ORDER BY 1
I’m struggeling to calculate my total power consumption, because these values I only have as the current Watts.
mmh, i guess you’re right that is morge a postgresql question. I will post the questen there aswell.
So whats my definition of power consumption
In the 2nd picture you can see how much power i use every 10 sec for the last 24 hours. Sometimes i use more energy, sometimes less
So the value i want to have is the avarage of these values for the last hour. This would be the power consumption of one hour. If i want to check the time period of 24 hours i have to build the average of the last 24 hours and multiply it with 24 hours