Having trouble trying to configure the energy dashboard

I have a non-traditional energy setup.

Energy Producers

  • I have a generator that charges a battery.
  • I have a solar panel assembly that charges the same battery.
  • I have the ability to charge this battery with grid power too, if needed.

Energy Storage

  • The battery mentioned above stores all the energy from the energy producers above.

Energy Usage

  • This battery provides all power to all devices. These powered devices are not directly connected to any of the energy producers listed above…only the battery. I, subsequently, have means to measure the power used by two circuits plugged into the battery.

I have sensors for each device listed above.

  • Power from generator
  • Power from solar
  • Power from grid
  • Power to battery (from all three sources - gen, solar, grid)
  • Power from battery
  • Power to circuit 1
  • Power to circuit 2
  • Energy from generator
  • Energy from solar
  • Energy from grid
  • Energy to battery
  • Energy from battery
  • Energy to circuit 1
  • Energy to circuit 2

I have my energy dashboard configured as such:
Grid

  • Energy from generator
  • Energy from grid

Solar

  • Energy from solar

Battery

  • Energy from battery
  • Energy to battery

Individual Devices

  • Energy from Circuit 1
  • Energy from Circuit 2

What I’m having trouble with is getting the numbers to equal out. Can someone explain to me, simply, how the energy dashboard is using these energy sensors to do what it does?

The basic equation of home energy balance, where sum of generators = sum of consumers, gives

solar + grid import + battery discharge = load + grid export + battery charge

Home Assistant Energy dashboard works on the basis that you define at least one of grid or solar, and it works out the house consumption (load) from the equation as:

Consumption = Import + Solar + From battery - Export - To battery

from each provided sensor, as a total for any given period.

Since the Energy Dashboard only deals with energy, you can only use energy sensors. Hence

Consumption (energy used) =

Energy from solar + {Energy from grid + Energy from generator} + Energy from battery - Energy to grid - Energy to battery

Home Assistant works out the Consumption by solving the (up to) 6-variable equation knowing 5 variables. In your case you have Grid and Solar but also Generator, but you don’t have Grid Export.

Assuming that, for example, you have for yesterday

  • 1 kWh from solar
  • 2 kWh from the generator
  • 3 kWh from the grid

Then your energy to the battery I assume is 6 kWh
And you have used the battery completely to run your load, hence you take 6 kWh from the battery.

Consumption = 1 + 3 + 2 + 6 - 0 - 6 = 6

So you consume 6 kWh.

The individual devices, if defined, will be taken as part of the consumption, with anything unspecified being the difference between the calculated consumption and the sum of all the defined devices.

Hence if Circuit 1 is 4 kWh, and Circuit 2 is 2 kWh

Consumption = 6 kWh
Named device consumption = 6 kWh
Undefined consumption = 0 kWh

So it all balances.