I’d like to do a one off calculation of the energy my home battery system has provided in it’s lifetime.
I’ve got a sensor that tracks the battery discharge energy I know I can set a template sensor integrting it’s value let’s say over a 10 year period but If I’m not wrong this will start at 0 and increase over time, furthermore in this way I think HA will continuously update that sensor, a thing that I don’t need at all.
The objective is to find, at current enegy prices where I live (I have a flat tariff), the average return of investment on the battery pack and decide, when the state of health of the battery will be lower if/when replace the battery itself.
I use mariadb as my backend with 366 days of retention. Is there a way to craft a SQL query to do the calculations? Or, better still, is there a statistic already readable?