Fronius, photovoltaic, BYD battery -> Wrong energy dashboard

Hi everyone, I created some sensors to monitor the energy dashboard, only it doesn’t give me good values ​​(as you can see from the screenshot). What am I doing wrong?


2 energy home assistant

SENSOR CODE:

  template:
    - sensor:
        - name: "Battery Power Charging"
          unit_of_measurement: W
          device_class: power
          state: "{{ max(0, 0 - states('sensor.solarnet_batteria_di_alimentazione') | float(default=0)) }}"
        - name: "Battery Power Discharging"
          unit_of_measurement: W
          device_class: power
          state: "{{ max(0, states('sensor.solarnet_batteria_di_alimentazione') | float(default=0)) }}"
        - name: "Power Photovoltaics"
          unit_of_measurement: W
          device_class: power
          state: "{{ states('sensor.solarnet_potenza_fotovoltaica') | float(default=0) }}"
        - name: "Power Grid Import"
          unit_of_measurement: W
          device_class: power
          state: "{{ states('sensor.solarnet_power_grid_import') | float(default=0) }}"
        - name: "Power Grid Export"
          unit_of_measurement: W
          device_class: power
          state: "{{ states('sensor.solarnet_power_grid_export') | float(default=0) }}"
  sensor:
      - platform: integration
        source: sensor.battery_power_charging
        name: "Total Battery Energy Charged"
        unit_prefix: k
        method: left
      - platform: integration
        source: sensor.battery_power_discharging
        name: "Total Battery Energy Discharged"
        unit_prefix: k
        method: left
      - platform: integration
        source: sensor.power_photovoltaics
        name: "Total Photovoltaics Energy"
        unit_prefix: k
        method: left
      - platform: integration
        source: sensor.power_grid_import
        name: "Total Grid Import Energy"
        unit_prefix: k
        method: left
      - platform: integration
        source: sensor.power_grid_export
        name: "Total Grid Export Energy"
        unit_prefix: k
        method: left

Hey, can you post some of the entity graphs?

Thanks for replay!

Here the HA graphs:


Grid export
Photovoltaic

battery charge
Energy

Here Fronius APP:

Ok so what I clearly see is that Power Photovoltaics is Watt (W) which probably should be kW. That is also probably why your production is baisically zero.
Because the Battery sensors also didnt change, you need to look if that is the same problem. For the import/export sensors you need to check with your real power meter if the values are correct.

Then you can also decide if you want to skip the template sensors, because you should have these sensors directly from Fronius, which you can use for Riemann Sums.