I created a binary sensor that switches from true to false depending on the position of my house’s electrical energy supply (true: solar, false: enedis).
I would like to be able to make a count per hour of the position of this sensor to be able to calculate per month and over the year my percentage of autonomy.
I am with a hybrid inverter and a 14 kWh LifePo4 battery
Thanks for your insights
Edit :
To go further, it would be more interesting to be able to calculate conditional time.
Like, counting the consumption of the house while the sensor is on true and the same thing on false. Then do the calculation: kwh sensor true / (kwh sensor false+kwh sensor true) / 100
And there we would have the percentage of autonomy
Thank you for your feedback which brings me new light.
after careful consideration and in order to calculate my percentage of electrical autonomy, I must compare:
electricity consumption of the house if autonomous mode is ON
and total electricity consumption of the house over the same period.
So I created a utility_meter:
total household daily, monthly and annual consumption
Thanks to your method, I created a sensor that calculates the consumption of the house in off grid mode and then created a utility_meter for it daily, monthly and annually.
I now want to create a template_sensor that would allow me to compare:
sensor.offgrid_consumption_daily*100 / sensor.total_consumption_daily