In Spain and other countries, users of photovoltaic panels with surplus compensation have net balance, which calculates the final result of import and export every hour and bills accordingly.
To put it simply: If you export 3 kWh and import 1 kWh in one hour, it will simply be considered that you have exported 2 kWh.
Since exporting is always cheaper than importing, this represents significant savings for the user.
Let's assume that importing costs €0.15/kWh, and exporting gives a discount of €0.11/kWh. In the first case, we export 3 kWh and import 1 kWh, and in the second case, it's the opposite.
1 * €0.15 - 3 * €0.11 = -€0.18
3 * €0.15 - 1 * €0.11 = €0.34
1 - 3 = -2 => -2 * €0.11 = -€0.22
3 - 1 = 2 => 2 * €0.15 = €0.30
As we can see, in both cases, net balance benefits the user.
This component calculates your current hourly balance as well as the result at the end of the hour.
To do this, you need to provide the total imported and exported kWh from your inverter, and the component will create three new entities:
- Net Import
- Net Export
- Current Net Balance
You can then use Net Import and Net Export in the Energy panel for Home Assistant to perform calculations correctly.
You can install the component using HACS. To do this, simply add this repository to your custom repositories and search for "balance neto".
Once installed, go to Devices and Services -> Add Integration and search for Balance.
The assistant will ask for 2 entities: total import from grid kWh and total exported to grid kWh.
Additionally, it will request the time period, which can be hourly (as is the case in Spain) or every quarter of an hour.
Finally, you can select a safety offset since Home Assistant may take a moment to perform the calculations; it will carry them out 5 seconds before the end of the period, but this can be modified if necessary.
Once the component is configured, use "Net Import" as the sensor for network consumption and "Net Export" for network feed.
Thanks to the Current Hourly Balance entity, you can activate and deactivate high-consumption devices, such as electric water heaters, to make the most of the surpluses.
Instead of using power regulators to adjust consumption to your current production, you can turn the device on and off based on the balance value. For example, turn on the water heater/AC when the net balance is greater than 0.2 kWh and turn it off when it's less than -0.05 kWh.
This way, we can avoid reducing power when a cloud passes by temporarily or never turning on a 1500W device if our surpluses are 750W when we could have it on for half an hour without any issues.