Howto: Fronius Integration with battery into Energy Dashboard

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

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
method: left
- platform: integration
source: sensor.battery_power_discharging
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

Hi !
Id use a power entity for that. `SolarNet Power Grid` for example.

Hi,

Thanks for your answer. SolarNet Power Grid, and then checking if its negative or positive?

Sure. Id probably do a automation that works like a hysteresis logic. Like
on-branch

• turn on above water heating power + ~200 W
• delay for ~ 10 minutes to avoid switching too often (If your water heater doesn’t do that by itself)

off-branch

• turn off on below 0
• delay again

Symos (and probably others too) provide that kind of logic out of the box with their IO Ports. So maybe you don’t need HA at all for that kind of thing.

Hey everyone,

me again. I have switched the total battery charged, discharged and Photovoltaics from the config file to helpers. And it seems to screw up stuff.

According to Fronius app I have used 6,9 from the grid and have zero production as of now.

I have created the helper as Riemansum with left, which as per my understanding should be same as:

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

``````

When checking the sneosrs they show the following values:
sensor.total_photovoltaiik: 101,13

Any ideas what could cause this error?

Thanks to everyone I have successfully configured a Fronius Gen24 with a BYD battery, Using the custom power flow card (GitHub - ulic75/power-flow-card: A power distribution card inspired by the official Energy Distribution card for Home Assistant) I also have a live view as well.

.

My advice to anyone still struggling is to go into the integration for each of the Fronius Devices, Turn on any of the “entities not shown” then use ADD TO DASHBOARD to send all the entities to a new dashboard

Then from this dashboard it is much easier to find and match entites to the fronius live view and the energy management screen

The lovelace config is for the live view is:

``````
- title: mirror
type: panel
path: mirror
cards:
- type: horizontal-stack
cards:
- type: custom:power-flow-card
title: Energy distribution Now
kw_decimals: 2
entities:
battery: sensor.solarnet_power_battery
grid: sensor.solarnet_power_grid
solar: sensor.solarnet_power_photovoltaics
inverted_entities: null

- title: Energy distribution Today
type: energy-distribution

``````

And my configuration.yaml settings

``````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 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

``````

Good Luck!

Hi guys,

can somebody also please post a screenshot of the Riemann Sum variables configuration?
Thank you.
Alex

in the post above, the sensor section has them:

``````sensor:
- platform: integration
source: sensor.battery_power_charging
name: "Total Battery Energy Charged"
unit_prefix: k
method: left
``````

method:
Riemann sum method to be used. Available methods are `trapezoidal` , `left` and `right` .