Howto: Fronius Integration with battery into Energy Dashboard

what is the actual state? Maybe -0? Then I’d just wait some time to get it populated.

You can set a unique_id in your template sensors and integration (riemann sum) sensors to be able to rename it from UI without having to worry about changing entity_id or loosing history data etc.

Even easier, use helpers to define your integration (riemann sum) sensors instead of yaml.
Open your Home Assistant instance and show your helper entities.

2 Likes

Hello every one,
i try to configure my fronius setup but it doenst work. I hope every one can help me.

My setup:
1x Primo GEN24 4.6 Plus (WR1)
1x Symo 6 (WR2)
1x Symo 10 (WR3)
1x PowerMeter
1x BYD Battery

I add all three Fronius to HA and i see many informations. I try some configurations in the yaml file.

Can anyone help me with the configuration, please?

Hi @farmio,

thanks. I’ll put helpers on my learning list :slight_smile:
Also you were right that the failure disappeared after a certain time.

The figure for total usage seem to be more or less correct. But the total photovoltaics production is off by about 1kWh. Is this because it is being calculated or is there something wrong?


I try the code from @0la1

template:
  - sensor:
      - name: "Battery Power Charging"
        unit_of_measurement: W
        device_class: power
        state: "{{ max(0, 0 - states('sensor.solarnet_power_battery') | float(default=0)) }}"
      - name: "Battery Power Discharging"
        unit_of_measurement: W
        device_class: power
        state: "{{ max(0, states('sensor.solarnet_power_battery') | float(default=0)) }}"
      - name: "Power Photovoltaics"
        unit_of_measurement: W
        device_class: power
        state: "{{ states('sensor.solarnet_power_photovoltaics') | float(default=0) }}"

sensor:
  - platform: integration
    source: sensor.battery_power_charging
    name: "Total Batterie geladen"
    method: left
  - platform: integration
    source: sensor.battery_power_discharging
    name: "Total Batterie entladen"
    method: left
  - platform: integration
    source: sensor.power_photovoltaics
    name: "Total Photovoltaik"
    method: left

and i see now the informations from the first device WR1 and the informaions are not correct. I think I have to add the other inverters too, but how?

Hi @NeoGolaz,

I would think that when you have three inverter, you would need to add all three inverter sensors to the code. That is only my guess, so please bear with me if that not works.

That’s right, as long as they are not connected in a common SolarNet instance (directly via cable) - then the powerflow endpoint would sum all connected devices.

@NeoGolaz comparing the values of your 2 screenshots doesn’t make sense. One is power, the other daily energy.

The first i will try to fix the informations and than add the other two inverter.
I create the power photovoltaic sensor and see him in the dev tools but in ther dashboard from the energy i only see the fronius.

template:
  - sensor:
      - name: "Battery Power Charging"
        unit_of_measurement: W
        device_class: power
        state: "{{ max(0, 0 - states('sensor.solarnet_power_battery') | float(default=0)) }}"
      - name: "Battery Power Discharging"
        unit_of_measurement: W
        device_class: power
        state: "{{ max(0, states('sensor.solarnet_power_battery') | float(default=0)) }}"
      - name: "Power Photovoltaics"
        unit_of_measurement: W
        device_class: energy
        state: "{{ states('sensor.solarnet_power_photovoltaics') | float(default=0) }}"

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'
  - platform: integration
    source: sensor.battery_power_charging
    name: "Total Battery Energy Charged"
    method: left
  - platform: integration
    source: sensor.battery_power_discharging
    name: "Total Battery Energy Discharged"
    method: left
  - platform: integration
    source: sensor.power_photovoltaics
    name: "Total Photovoltaics Energy"
    method: left

Please learn about the differences of power and energy. The energy panel only accepts energy entities.

@farmio Please check the picture with “created sensor” → device_class: energy
I think the created sensor is correct.

Apart form being named “Power…”, it uses a power unit (W) instead of an energy one (Wh) and misses a valid state_class (total_increasing, not sure if total is valid too).
It’s also representing a power value, in contrast to “Total Photovoltaics Energy” which is the according calculated energy value.

No it is not. As @farmio suggested, check what is the difference between power and energy.

Power (Electric power - Wikipedia) is U (Voltage, electric potential, Voltage - Wikipedia) * I (Current, Electric current - Wikipedia) and it is measured in Watts.

Meanwhile Energy is the time integral of Power and measured in Watt-hour or Kilowatt-hour. (Kilowatt-hour - Wikipedia).

I have no idea how are your inverters are wired, are they DC or AC connected, so the best approach is for you, create the Power Photovoltaics for each of your inverters, create the Battery Charge Power and Battery Discharge Power for your inverters which has the battery connected. And then create the integration/integral (Helper!) for all of those Power sensors. Once all the of the integrals are calculated, add the Photovoltaic Energy ones from each inverter to the Energy Dashboard under the Photovoltaic Source part and add the Battery ones under the Battery Section. You should have all set then.

But, by the way, what is the point to have two Symo and one Primo inverter on the same circuit? I would understand if you have all Symo, but I don’t get the point of the Primo, if you don’t mind to answer it.

im new what i have to do? i dont understand? what is the code mean?

thx and regards

Read more first of all.

I am currently trying to integrate my BYD storage into the Energy Dashboard using this How To.

But after adjusting the corresponding lines, I get this error message?

What am I doing wrong? I do not get it?

Looks like you have another template: key at a different place.

maybe this has something to do with it?

What should the code look like for it to work?

template:
  - sensor:
      - name: "Heizstab Total"
        unique_id: energy_total
        state: >-
          {{ 
            [ states('sensor.phase_a_energy'), 
              states('sensor.phase_b_energy'),
              states('sensor.phase_c_energy'),
            ] | map('float') | sum
          }}
        availability: >-
          {{ 
            [ states('sensor.phase_a_energy'), 
              states('sensor.phase_b_energy'),
              states('sensor.phase_c_energy'),
            ] | map('is_number') | min
          }}
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        
  - sensor:
      - name: "Heizstab Power Total"
        unique_id: power_total
        state: >-
          {{ (states('sensor.phase_a_power')|float + 
              states('sensor.phase_b_power')|float + 
              states('sensor.phase_c_power')|float) }}
        unit_of_measurement: W
        device_class: power
        state_class: measurement
      - name: "Power Factor Total"
        unique_id: power_factor_total
        state: >-
          {{ (((states('sensor.phase_a_power')|float) * (states('sensor.phase_a_power_factor')|float) +
                (states('sensor.phase_b_power')|float) * (states('sensor.phase_b_power_factor')|float) +
                (states('sensor.phase_c_power')|float) * (states('sensor.phase_c_power_factor')|float)) /
              (states('sensor.phase_a_power')|float + states('sensor.phase_b_power')|float + states('sensor.phase_c_power')|float))
              |int }}
        unit_of_measurement: "%"
        device_class: power_factor
        state_class: measurement
        
        
template:
  - sensor:
      - name: "Battery Power Charging"
        unit_of_measurement: W
        device_class: power
        state: "{{ max(0, 0 - states('sensor.symo_gen24_power_battery') | float(default=0)) }}"
      - name: "Battery Power Discharging"
        unit_of_measurement: W
        device_class: power
        state: "{{ max(0, states('sensor.symo_gen24_power_battery') | float(default=0)) }}"
      - name: "Power Photovoltaics"
        unit_of_measurement: W
        device_class: power
        state: "{{ states('sensor.symo_gen24_power_photovoltaics') | float(default=0) }}"

sensor:
  - platform: integration
    source: sensor.battery_power_charging
    name: "Total Batterie geladen"
    method: left
  - platform: integration
    source: sensor.battery_power_discharging
    name: "Total Batterie entladen"
    method: left
  - platform: integration
    source: sensor.power_photovoltaics
    name: "Total Photovoltaik"
    method: left

Use only 1 template: key, not 1 per item. - sensor: defines a list-item so you can have multiple under one single root key.

That only works to a limited extent.

  1. I can’t see the entities in the energy dashboard.
  2. Do I now get a message that my gas meter is no longer working properly

I don’t know where are you from, but in the middle of the night those entities are not going to show up until there is PV production and battery charging, etc…

We have no idea how you set up your gas meter in the configuration.yaml, but I believe you are in lack of understanding how you should manually configure things in the configuration.yaml, and that causes your issues all over.

Hello,

I have integraded my fronius sucessfully. But I have still a problem:
How can i get the overflage energy (energy produced - energy used?).

I want to activate my warm water heating when i got too much energy, but actually i can´t get this value from one of the standard entities?

Thanks a lot