Fronius Integration into Energy dashboard

Hello,

I had succesfully configured (basic) by fronius integration but I cannot find the current usage sensors in the Energy sessting.

my configuration.yaml

# Fronius Integration
sensor:
  - platform: fronius
    resource: http://solar.homeland.local
    scan_interval: 5
    monitored_conditions:
    - 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: energy
        friendly_name: "Energie Solar Photovoltaics Power"
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.power_photovoltaics_fronius_power_flow_0_http_solar_homeland_local')|float }}"

      house_power:
        device_class: energy
        friendly_name: "Energie Total House Power Consumption"
        unit_of_measurement: "W"
        value_template: "{{ 0 - states('sensor.power_load_fronius_power_flow_0_http_solar_homeland_local')|float }}"

      # 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: energy
        friendly_name: "Energie Grid Imported Power"
        unit_of_measurement: "W"
        value_template: "{{ [states('sensor.power_grid_fronius_power_flow_0_http_solar_homeland_local')|float, 0]|max }}"

      grid_export_power:
        device_class: energy
        friendly_name: "Energie Grid Exported Power"
        unit_of_measurement: "W"
        value_template: "{{ [0 - states('sensor.power_grid_fronius_power_flow_0_http_solar_homeland_local')|float, 0]|max }}"

Home:

Help!! I have the same problem!

The meter device id should be “0” in most cases. It would also have been the default.

If you have a meter you should probably turn off night-shutdown in the inverters preferences - otherwise no consumption data can be read.

I think device ID “1” is fine as I get the data and check it.

http://solar.homeland.local/solar_api/v1/GetMeterRealtimeData.cgi?Scope=Device&DeviceId=1

So you don’t have the Fronius SmartMeter installed?
What do you get for http://solar.homeland.local/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System ?

In your templates you are mixing up energy and power everywhere (Unit, device_class, name, …).

{
   "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