Virtual Battery for Solar panels

Hello,

I have a virtual battery in my solar system (I can send back the power to grid and then use it later).
I would like to create an virtual sensor which can monitor my battery charge level in kWh.
Can you help my how to do it?

I have a shelly 3em sensor next to my utility meter and I have a sensor.total_house_power which is measuring the total power going in and out from my house. positive values - power going from grid to house, negative values - power is going from house to grid.
I have also two sensors with are measuring the total imported energy and total exported energy sensor.energy_export_sum and sensor.energy_import_sum

do you have any idea how can i calculate the charge of my virtual battery?

thank you

1 Like

‘’’ I’m facing the same challenge right now and somehow I’m not getting anywhere.
I found an integration called Battery_sim (Github).
The installation via HACS worked easily. Unfortunately the application shows a strange phenomenon. The charging process always ends after exactly 10 seconds.
Did you get further with your search. Would you like to try out Battery_Sim?’’’

In my case this sensor works fine. Im using shelly 3em pro for consumption measuring and i added total sensors to import/export.
thank you for tip :slight_smile:

What exactly is the battery charge? The difference of sent to the grid minus consumed from the grid?

If so, that would be a simple template sensor (exported - imported) and maybe some other math for a percent if there is a cap or something.

I don’t have anything like this, so I apologize if I’m missing something.

yes its imported - exported(with some capping). the Battery_sim has all the features to simulate the battery. It can also simulate the Import Export energy.

Hi Benjamin, could you please share how your code? Im trying to use this integration but no luck so far.
Thanks

im using Shelly 3EM 3-phase Net Metering templates for Import, export and consumption
to monitor the import export via shelly and use net metering and then i used sensor.power_import and sensor.power_export values