Hello. Hoping that someone might have some knowledge to help me.
I have a PV system returning excess production to the grid and my energy utility bills me by calculating the net energy consumption in 15 minute blocks. This means that, every 15 minutes, they take the consumed and returned energy, calculate the net amount and use this value as the amount consumed in those 15 minutes. They then bill me monthly by summing all these 15 minute net blocks.
I’m trying to replicate these calculations in HA but I’m having a hard time. The only information I have available is the total consumed and returned energy values as reported by a Shelly EM. I tried to create two quarterly hour utility meters, for consumed and returned energy and then have a template that nets it, but this is not exactly what I need since the template will update with every state change. I would need a way to make the calculation every 15 minutes and only then zero the quarterly hour meters.
This is a tricky one. My solution (there’s probably a better way):
Create your two quarter-hourly cycle utility meters, lets call them energy_15_minute_in and energy_15_minute_out. The use a triggered template sensor to calculate the net energy just before the end of each quarter hour (just before the utility meters reset) and add it to itself (so it keeps a running total).
sensor.total_15_minute_energy will keep counting up forever but you can add it to your energy dashboard to keep track of daily/monthly/yearly energy and cost.