I need some help with figuring out how to usefully combine various power readings with different update frequencies.
I have solar panels, and I have just installed a Shelly EM with 1 clamp to monitor my main electric import/export. It is doing this brilliantly, and I have created a couple of extra template sensors to give me instant import/export readings in Watts - so Import is always positive or zero, and similarly Export is always positive or zero (don’t want gauges going negative).
I also have the Solis integration which gives me data from my solar panels. So, I figured I could use these 3 sensors to create another template sensor giving me the current net consumption (Watts) of the entire house, which would be
net consumption = (current solar inverter output) - (current grid export) + (current grid import)
This would in theory give a correct answer at any time of day/night.
The problem is, the grid figures coming from the Shelly are updating all the time, and the solar output figure from the Solis inverter only updates every few minutes (5? whatever…)
So in between the updates from the solis, the grid figures can vary by large amounts, resulting in a uselessly inaccurate figure for the calculation for the net house consumption.
I first thought of making the net house consumption sensor a trigger based one, triggered on the state update of the solis output value. So it would not update very often, but it would at least be accurate at that moment. But then I realised this would mean that the trigger would not happen once the inverter shuts down when it gets dark, so my house consumption reading would not update at night.
So what I really need is to update my net consumption sensor when the solis output reading updates during the day, but when the solis output stops updating, to update my net consumption all the time, as only the Grid Import reading would be non-zero at that time.
All the kWh entities from Shelly and Solis fed in to the Energy dashboard will give me good useful data over time, but an instant “what Watts are we using right now?” number is always good to see.
Can anyone see a neat way of handling this? Has anyone got a similar setup? Or am I just going to have to live with an instant net consumption figure that’s better than nothing but not hugely accurate?
And before you ask, I cannot put a second Shelly clamp on the inverter output because it is nowhere near the house meter box where the Shelly EM is, and I cannot justify another 60 pounds to put another EM where the inverter is. So for now I am stuck with the solis integration reading.