Home Battery Storage: charged vs discharged energy reversed?

Hi.

Under Energy → Home Battery Storage, the math on the values for the power going in vs. power going out seem to be reversed. I’ve made sure I haven’t reversed the entities.

“Energy going in to the battery (kWh)” is displaying as a negative value
“Energy comping out of the battery (kWh)” is displaying as a positive value

This doesn’t seem right to me. Is there a way to correct this problem?

image

My configuration.yaml

  - sensor:
      - name: "Battery - Discharging Energy"
        state: "{{ states('sensor.amount_of_discharged_energy') | float | round>
        unit_of_measurement: 'kWh'
        state_class: total_increasing
        device_class: energy
        attributes:
          last_reset: ‘2021-11-09T00:00:00+00:00’

  - sensor:
      - name: "Battery - Charging Energy"
        state: "{{ states('sensor.amount_of_charged') | float | round(2) }}"
        unit_of_measurement: 'kWh'
        state_class: total_increasing
        device_class: energy
        attributes:
          last_reset: ‘2021-11-09T00:00:00+00:00’