Fronius Integration into Energy dashboard

{
   "Body" : {
      "Data" : {
         "1" : {
            "Details" : {
               "Manufacturer" : "Fronius",
               "Model" : "S0 Meter at inverter 1",
               "Serial" : "n.a."
            },
            "Enable" : 1,
            "EnergyReal_WAC_Minus_Relative" : 65,
            "Meter_Location_Current" : 1,
            "PowerReal_P_Sum" : -810.26331588760559,
            "TimeStamp" : 1633028596,
            "Visible" : 1
         }
      }
   },
   "Head" : {
      "RequestArguments" : {
         "DeviceClass" : "Meter",
         "Scope" : "System"
      },
      "Status" : {
         "Code" : 0,
         "Reason" : "",
         "UserMessage" : ""
      },
      "Timestamp" : "2021-09-30T21:03:17+02:00"
   }
}

That’s unfortunate. Fronius doesn’t seem to report energy data when using an S0 meter. You’ll have to use the Riemann sum integration integration to calculate energy from power.

my final config:

# START Fronius Integration

sensor:
  - platform: fronius
    resource: http://192.168.200.252
    scan_interval: 5
    monitored_conditions:
      - sensor_type: logger_info
      - sensor_type: inverter
        device: 1
      - sensor_type: meter
        device: 1
      - sensor_type: power_flow

  - platform: template
    sensors:
      # The raw Fronius photovoltaic state goes to unknown after dark, so force it to zero
      photovoltaics_power:
        device_class: power
        friendly_name: "Stromproduktion"
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.power_photovoltaics_fronius_power_flow_0_http_192_168_200_252')|float }}"

      house_power:
        device_class: power
        friendly_name: "Stromverbrauch"
        unit_of_measurement: "W"
        value_template: "{{ 0 - states('sensor.power_load_fronius_power_flow_0_http_192_168_200_252')|float|round(1) }}"

      # The raw grid power is negative if exporting and positive if importing, so produce
      # separate figures here so we can calculate energy based on them below
      grid_import_power:
        device_class: power
        friendly_name: "Stromeinkauf"
        unit_of_measurement: "W"
        value_template: "{{ [states('sensor.power_grid_fronius_power_flow_0_http_192_168_200_252')|float, 0]|max }}"

      grid_export_power:
        device_class: power
        friendly_name: "Stromverkauf"
        unit_of_measurement: "W"
        value_template: "{{ [0 - states('sensor.power_grid_fronius_power_flow_0_http_192_168_200_252')|float, 0]|max }}"

        # Convert W in kWh for energy dashboard
  - platform: integration
    source: sensor.grid_import_power
    name: Strom gekauft
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.grid_export_power
    name: Strom verkauft
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.photovoltaics_power
    name: Strom produziert
    unit_prefix: k
    round: 2

# END Fronius Integration
2 Likes

Hallo Toboli,

danke für deine Informationen!
Ich besitze einen Fronius Gen24 Wechselrichter und eine BYD Batterie.
Die angezeigten Werte stimmen nicht mit den vom WEB Interface des Wechselrichter zusammen.

Meine Konfig sieht derzeit so aus.

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
** - platform: google_translate**

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
** - platform: fronius**
** resource: http://192.168.99.1**
** scan_interval: 5**
** monitored_conditions:**
** - sensor_type: logger_info**
** - sensor_type: inverter**
** device: 1**
** - sensor_type: meter**
** device: 1**
** - sensor_type: storage**
** device: 0**
** - sensor_type: power_flow**


** - platform: template**
** sensors:**
** # The raw Fronius photovoltaic state goes to unknown after dark, so force it to zero**
** photovoltaics_power:**
** device_class: power**
** friendly_name: “Stromproduktion”**
** unit_of_measurement: “W”**
** value_template: “{{ states(‘sensor.power_photovoltaics_fronius_power_flow_0_http_192_168_99_1’)|float }}”**

** house_power:**
** device_class: power**
** friendly_name: “Stromverbrauch”**
** unit_of_measurement: “W”**
** value_template: “{{ 0 - states(‘sensor.power_load_fronius_power_flow_0_http_192_168_99_1’)|float|round(1) }}”**

** # The raw grid power is negative if exporting and positive if importing, so produce**
** # separate figures here so we can calculate energy based on them below**
** grid_import_power:**
** device_class: power**
** friendly_name: “Stromeinkauf”**
** unit_of_measurement: “W”**
** value_template: “{{ [states(‘sensor.power_grid_fronius_power_flow_0_http_192_168_99_1’)|float, 0]|max }}”**

** grid_export_power:**
** device_class: power**
** friendly_name: “Stromverkauf”**
** unit_of_measurement: “W”**
** value_template: “{{ [0 - states(‘sensor.power_grid_fronius_power_flow_0_http_192_168_99_1’)|float, 0]|max }}”**

** grid_import_power:**
** device_class: power**
** friendly_name: “Batterie entladen”**
** unit_of_measurement: “W”**
** value_template: “{{ [states(‘sensor.power_battery_fronius_power_flow_0_http_192_168_99_1’)|float, 0]|max }}”**

** grid_export_power:**
** device_class: power**
** friendly_name: “Batterie laden”**
** unit_of_measurement: “W”**
** value_template: “{{ [0 - states(‘sensor.power_battery_fronius_power_flow_0_http_192_168_99_1’)|float, 0]|max }}”**


** # Convert W in kWh for energy dashboard**
** - platform: integration**
** source: sensor.grid_import_power**
** name: Strom gekauft**
** unit_prefix: k**
** round: 2**

** - platform: integration**
** source: sensor.grid_export_power**
** name: Strom verkauft**
** unit_prefix: k**
** round: 2**

** - platform: integration**
** source: sensor.photovoltaics_power**
** name: Strom produziert**
** unit_prefix: k**
** round: 2**


** - platform: integration**
** source: sensor.grid_export_power**
** name: Batterie laden**
** unit_prefix: k**
** round: 2**

** - platform: integration**
** source: sensor.grid_import_power**
** name: Batterie entladen**
** unit_prefix: k**
** round: 2**

# END Fronius Integration

Hi!
This is very unreadable. Try editing your post and put yaml in code-blocks (tripple backticks `)

Make sure your Gen24 inverter runs the latest firmware. I think last week 1.13 was released - it fixes some bugs with the API.

Hallo, de Wechselrichter läuft mit der letzten Firmware 1.13…
Den Code habe ich nochmals, nun hoffentlich richtig, angefügt.

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: fronius
    resource: http://192.168.99.1
    scan_interval: 5
    monitored_conditions:
      - sensor_type: logger_info
      - sensor_type: inverter
        device: 1
      - sensor_type: meter
        device: 1
      - sensor_type: storage
        device: 0
      - sensor_type: power_flow
      
  - platform: template
    sensors:
      # The raw Fronius photovoltaic state goes to unknown after dark, so force it to zero
      photovoltaics_power:
        device_class: power
        friendly_name: "Stromproduktion"
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.power_photovoltaics_fronius_power_flow_0_http_192_168_99_1')|float }}"

      house_power:
        device_class: power
        friendly_name: "Stromverbrauch"
        unit_of_measurement: "W"
        value_template: "{{ 0 - states('sensor.power_load_fronius_power_flow_0_http_192_168_99_1')|float|round(1) }}"

      # The raw grid power is negative if exporting and positive if importing, so produce
      # separate figures here so we can calculate energy based on them below
      grid_import_power:
        device_class: power
        friendly_name: "Stromeinkauf"
        unit_of_measurement: "W"
        value_template: "{{ [states('sensor.power_grid_fronius_power_flow_0_http_192_168_99_1')|float, 0]|max }}"

      grid_export_power:
        device_class: power
        friendly_name: "Stromverkauf"
        unit_of_measurement: "W"
        value_template: "{{ [0 - states('sensor.power_grid_fronius_power_flow_0_http_192_168_99_1')|float, 0]|max }}"

      grid_import_power:
        device_class: power
        friendly_name: "Batterie entladen"
        unit_of_measurement: "W"
        value_template: "{{ [states('sensor.power_battery_fronius_power_flow_0_http_192_168_99_1')|float, 0]|max }}"

      grid_export_power:
        device_class: power
        friendly_name: "Batterie laden"
        unit_of_measurement: "W"
        value_template: "{{ [0 - states('sensor.power_battery_fronius_power_flow_0_http_192_168_99_1')|float, 0]|max }}"
        

    # Convert W in kWh for energy dashboard
  - platform: integration
    source: sensor.grid_import_power
    name: Strom gekauft
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.grid_export_power
    name: Strom verkauft
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.photovoltaics_power
    name: Strom produziert
    unit_prefix: k
    round: 2
    
  - platform: integration
    source: sensor.grid_export_power
    name: Batterie laden
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.grid_import_power
    name: Batterie entladen
    unit_prefix: k
    round: 2

# END Fronius Integration```

Doesn’t a Gen24 inverter with 1.13 provide energy entities by default (without having to use Riemann sum integration)?

1 Like

Hallo Franz

Ich habe anscheinend die gleiche Hardwarekonfiguration wie du. Ist es dir gelungen den Fronius in das Home Assistant Energy Board einzubinden?

Hi, I have tried to use your config with my Fronius Symo Hybrid, so far it looks good, only that in the Energy Dashboard is reporting the power I am using from my Battery as consumption from the grid.
See screenshot below, maybe there is a solution for it. Did you manage to set it up correctly?


So the consumption from the Grid seems to be wrong, as it shows the same mount I am using from the battery.

Hallo, leider bin ich auch noch nicht weiter gekommen.

@farmio First of all, thanks for providing the New Fronius Integration. My Fronius is a Gen24 with Firmware 1.14.1. In the Documentation you mention that we should use a Riemann Sum for adding a Battery to the Energy-Dashboard. Do you have an example? I can’t get my head around for Integrating my Battery.

Thanks
Lukas

have a look some posts above: Fronius Integration into Energy dashboard - #13 by almtaler

This looks quite promising, apart from the entity names - which are used twice for grid and battery (grid_import_power and grid_export_power) - but you should only need the battery ones anyway. So I guess (copied untested as I don’t have a battery myself):

sensor:
  - platform: template
    sensors:
      battery_discharge_power:
        device_class: power
        friendly_name: "Batterie entladen"
        unit_of_measurement: "W"
        value_template: "{{ max(0, states('sensor.power_battery_fronius_power_flow_0_http_192_168_99_1') | float) }}"

      battery_charge_power:
        device_class: power
        friendly_name: "Batterie laden"
        unit_of_measurement: "W"
        value_template: "{{ max(0, 0 - states('sensor.power_battery_fronius_power_flow_0_http_192_168_99_1') | float) }}"
        
  - platform: integration
    source: sensor.battery_charge_power
    name: Batterie geladen
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.battery_discharge_power
    name: Batterie entladen
    unit_prefix: k
    round: 2

Just try it and let me know if it works :man_shrugging:

1 Like

Looks promising.
I’ll let it run for a few days and check the values and will come back with a result.

1 Like

Just a quick respond: Energy to Battery looks rock solid and the values are nearly the same as reported by the Fronius Smartmeter.

Energy from Battery Look like the values are to high. Since there is not much Sun in Austria at the Moment, my Battery does not charge really much. I’ll have a closer Look over the next few days/weeks an keep you informed.

1 Like

Today was a little bit more Sun here. If more Energy get pulled out from the Battery (or the last 5% a pulled out to a lower State of Charge) it looks very good. Today there is only a difference from 0.05 kwh energy from the battery.

So it looks good.
I’ll keep you updated

Did anyone switch from the Fronius platform to the Fronius integration?
I don’t know what happened in my system, but from the moment I started using the integration the solar production measure skyrocketed (wrong values and as if Wh are being interpreted as kWh).

I’m using the energy_total_fronius_inverter_1 sensor. It used to work perfectly.

Any clue about what may be happening?

What are its states? Open your Home Assistant instance and show your state developer tools.
Do you have any customize:ed entities?

This is the state for the main sensor (the one I’m using for the solar panels):

state_class: total_increasing
unit_of_measurement: Wh
device_class: energy
friendly_name: Energy total

Nonetheless, it seems that everything is working ok right now. I did not do anything, so I guess it was some kind of glitch.

The only drawback is that now both Energy total and Energy Year are way off what should be their real value. I wonder which records would I need to update on the DB to make it right.

Did you use the core Fronius integration, or the custom component before? The core integration did always report Wh afaik.

No idea how to change these things in db, but I’ve seen some posts about such here (mostly removing single entries) - you’ll surely find that info somewhere in the forums.

I used the integration via YAML settings, but now I’m using the integration on the GUI.