Page 1 of 1

Monthly self-consumption percentage for solar energy.

Posted: Sunday 24 September 2023 12:53
by pat44
Hi all,

I'm currently using the custom graph function to display information regarding my solar energy equipment.
It works pretty well. Please see the picture.
In yellow : solar production
In red : solar injection in the grid (negative value). It corresponds to the "surplus"
In blue : consumption from the grid (EDF as I reside in France).
What I want is to automatically calculate and display my self-consumption percentage (see the black line).
self-consumtion = (solar_prod + solar_injection) / solar_prod (solar_injection is negative so that's OK).

Graph display works well for Daily report since Dashticz makes the calculation based on the CounterToday information I believe.
However, I'm struggling to have a good monthly report.

What I want is just to display the self-consumption line based on accumulated energy : (Sum_SolarProd + Sum_SolarInjection)/Sum_SolarProd
So simply it corresponds to (YellowBox + RedBox)/YellowBox
But Dashticz is calculating the self-conso percentage for each day, and make the average for the entire month.
In other words, Dashticz calculates this value: avg((SolarProd/SolarInjection)/SolarProd)). avg stands for "average of".
But I would like this calculation : (Sum_SolarProd + Sum_SolarInjection)/Sum_SolarProd

If someone could help me. Thanks in advance.

Re: Monthly self-consumption percentage for solar energy.

Posted: Sunday 24 September 2023 19:21
by pat44
See the json code here:

Re: Monthly self-consumption percentage for solar energy.

Posted: Wednesday 27 September 2023 19:59
by pat44
Please see below the picture showing the issue I have for August.
Self-consumption (also called auto-consumption) should be "100*(833,74-196,56)/833,74 = 76,4 %"
But Dashticz is returning 79,81% because it calculates the average of daily percentage for all the days in August.

The problem seems to be very straighforward and easy to solve.
But I think Dashticz is simply not appropriate to make such a calculation. It would require something as an intermediate function to make a monthly calculation and return this value to the custom graphic function. I dont' know if this is possible ? Or maybe I'm missing a simpler solution ?
However, I love very much Dashticz for its infinite possiblities, it is a very nice domoticz extension.

Re: Monthly self-consumption percentage for solar energy.

Posted: Friday 29 September 2023 7:40
by Lokonli
I understand the issue.

Probably I can add something to compute results from the aggregated data.
Like:

Code: Select all

   data: [
      SolarInj: 'd.v_277',
      SolarProd: 'd.v_274',
      GridConso: 'd.v_278'
   ],
   data_aggr: [
      AutoConso: '(aggr.SolarProd + aggr.SolarInj)*100/aggr.SolarInj'
  ]
Would this fulfill your needs? Additional suggestions?

Re: Monthly self-consumption percentage for solar energy.

Posted: Friday 29 September 2023 9:37
by pat44
Yes it would fully satisfy my needs.
Is this "data_aggr" method already present or you plan to add it ?
Thanks so much for your quick answer.

Re: Monthly self-consumption percentage for solar energy.

Posted: Tuesday 03 October 2023 6:50
by Lokonli
pat44 wrote: Friday 29 September 2023 9:37 Yes it would fully satisfy my needs.
Is this "data_aggr" method already present or you plan to add it ?
Thanks so much for your quick answer.
I plan to add it before the end of the year.

Re: Monthly self-consumption percentage for solar energy.

Posted: Wednesday 04 October 2023 20:09
by pat44
Perfect, thanks!

Re: Monthly self-consumption percentage for solar energy.

Posted: Friday 12 January 2024 8:24
by pat44
Hi @Lokonli, did you have time to work on this issue ?
Thanks.