hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
117 stars 14 forks source link

Add "corrected" import_sensor & export_sensor attributes #13

Closed Bascht74 closed 2 years ago

Bascht74 commented 2 years ago

Hi,

Thx for the last changes (adding more attrubutes).

I have an idea: Your integration uses two sensors for calculating the effect of the simulated battery: import_sensor & export_sensor

It would be great if your integration outputs a "corrected" import & export value in kWh as an attribute.

E.g. if the simulated battery is charging, the " corrected export_sensor" is not "exporting" that energy to the grid, so not counting up that energy. The corrected export_sensor could use the first value of the export_sensor as a starting point. Same for the import_sensor: the energy of the corrected import_sensor is reduced if the simulated battery is discarging, so not counting up that energy. The corrected import_sensor could use the first value of the import_sensor as a starting point.

That way everybody can add some template sensors and add those to e.g. energy dashboards to fully simulate the battery effect even to importing / exporting from/to the grid... (If somebody knows a good workaround with multiple template sensors, you are welcome to share... :-)

hif2k1 commented 2 years ago

This is included in the latest release. Let me know how it works. It should reset if the meter resets, but I'm not sure how all meters handle this so let me know if there are any bugs.

Bascht74 commented 2 years ago

Yes, it works. Forgot to answer…