Fronius inverter integration

All good just use to show zero

@safepay just got your new update. Updating it now. :slight_smile:

In your inverter settings you can change the Night Mode setting which keeps the data connection online even when the inverter is not inverting. You will need to capture the solar generation value and modify the Unknown to be 0 so that the graphs and data look nicer and probably work better for any triggers\notifications you might want to run

- platform: rest
  resource: http://SOLARINVERTER/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData
  name: "Raw Current Solar Power"
  value_template: '{{ value_json.Body.Data.PAC.Value }}'
  scan_interval: 10
    current_solar_power:
      friendly_name: "Current Solar Power"
      value_template: >-
        {% if is_state("sensor.raw_current_solar_power", "unknown")-%}
            0
        {%- else -%}
            {{ states("sensor.raw_current_solar_power") }}
        {%- endif %}
      unit_of_measurement: "W"

I could probably do the data input validation in one statement but this works as a starting point.

I already had this up and running a long time before the Fronius integration came out so I haven’t implimented it yet. If I get a battery system then I may consider the module to see what it can do but the datamanager built into the system seems to be very very feature plenty

The latest updates have better error and connection handling to minimise night time logs and avoid having to change the inverter setting to be always reporting.

Hi folks, Im struggling to get past first base with this.
I have added this to configuration.yaml.


sensor:
  - platform: fronius
    resource: 192.168.0.196
    monitored_conditions:
    - sensor_type: inverter

But it doesn’t pass the config checker.

Invalid config for [sensor.fronius]: invalid url for dictionary value @ data['resource']. Got '192.168.0.196'. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/fronius/

Please help. I have tried with quotes and different indentations to no avail.

@Delbz This core integration does not seem to work. Best you try this custom component as it works well and is easy to setup.

Look here: https://github.com/safepay/sensor.fronius

This thread is also worth looking through: Fronius Solar Component

1 Like

Thanks so much. I was going crazy.

I notice the ‘Fronius Day Energy’ reports in MWh - how can I change that to KWh?
Is there also an entity available for Daily Energy Used (from the power meter)?

@Delbz It’s all documented but like me (LOL) you may not have noticed it so you set this in your config:

    power_units: W
    units: kWh

And those sensors are setup when you configure the smart meter:

 - platform: fronius_inverter
    ip_address: Your_ip
    powerflow: True
    power_units: W
    units: kWh

then you get:
- grid_usage
- house_load
- panel_status
Read the documentation again (like I had to)…LOL

1 Like

The “resource” is wrong. It should be like this (the documentation is confusing on this part):

resource: http://192.168.0.196

And the core integration does work…I tried it a few days ago just to see how it compares to the other integration by @safepay, which I am running 24/7 without major issues. And they have also changed the core integration so that it now publishes all readings as individual sensors and not as attributes.

1 Like

@nilrog Thanks for clearing that up. If that’s the case though then the documentation needs to be updated as it is definitely unclear the way it is now. Fronius - Home Assistant

resource

(string)(Required)

The IP address of the Fronius device

OR

sensor:
  - platform: fronius
    resource: FRONIUS_IP_ADDRESS

OR

sensor:
  - platform: fronius
    resource: FRONIUS_URL

Well I guess the core integration would work given the correct configuration information.

For the effort to switch to the core integration now I really can’t see the point atm.
If it ever breaks maybe I will.

@nilrog. Thanks for the advice on prefixing http:// It was about the only thing I didn’t try!
I have it working now - however all of the measurements are in Watts. Do you know how I can display results in kW and kWh? The following commands don’t pass the config test.

power_units: W
units: kWh

Also some of the results have 10+ decimal points. How do you round them off?

@Delbz The core fronius integration is not as customisable as @safepay custom component at the moment. You could modify the sensors using template sensors

OK - Cheers! I will swap back.

not meant to be as publicity, however I see some analogies between your GUI and what I have set up here: Photovoltaics (PV) + battery + hass = maximize auto-consumption

Maybe you find some configs that you’d like to integrate?

1 Like

I’ve been working on enhancing the GUI.
Here’s my current energy screen.
Does anyone know how I can display the ‘rel_Autonomy’ field from the fronius API?

4 Likes

This looks awesome, well done.

Would you mind sharing all your fronius related setup? Particularly the pvoutput config in the inverter. Thank you!

Hi, looks really nice, would you share that screen with me?
I am interested in the card for Grid Usage, don’t know how to do that and which kind of card you are using.

Thanks

Sure.
Here’s the PVOutput configuration.yaml section

sensor:
  - platform: pvoutput
    system_id: xxx
    api_key: xxx
    scan_interval: 150
  - platform: template
    sensors:
      power_consumption:
        value_template: >
          {% set pc = state_attr('sensor.pvoutput', 'power_consumption') %}
          {{ '0' if pc == 'NaN' else pc }}
        friendly_name: 'Using'
        unit_of_measurement: 'Watt'

      energy_consumption:
        value_template: "{{ '{:.1f}'.format(state_attr('sensor.pvoutput', 'energy_consumption')|float/1000) }}"
        friendly_name: 'Used'
        unit_of_measurement: 'kWh'

      power_generation:
        value_template: >
          {% set pg = state_attr('sensor.pvoutput', 'power_generation') %}
          {{ '0' if pg == 'NaN' else pg }}
        friendly_name: 'Generating'
        unit_of_measurement: 'Watt'

      energy_generation:
        value_template: >
          {% set eg = state_attr('sensor.pvoutput', 'energy_generation') %}
          {{ '0' if eg == 'NaN' else '{:.2f}'.format(eg|float/1000) }}
        friendly_name: 'Generated'
        unit_of_measurement: 'kWh' 

and the dual gauge card that uses sensor.energy_consumption from PVOutput.

inner:
  colors:
    - color: var(--label-badge-green)
      value: 30
    - color: var(--label-badge-yellow)
      value: 10
    - color: var(--label-badge-red)
      value: 0
  entity: sensor.fronius_day_energy
  label: Gen
max: 80
min: 0
outer:
  colors:
    - color: var(--label-badge-red)
      value: 40
    - color: var(--label-badge-yellow)
      value: 20
    - color: var(--label-badge-blue)
      value: 0
  entity: sensor.energy_consumption
  label: Used
title: Energy (kWh)
type: 'custom:dual-gauge-card'


Sure. It’s the mini-graph card.
plus the tod platform in configuration.yaml to get the day/night effect

binary_sensor:
  - platform: tod
    name: Night
    after: sunset
    before: sunrise

color_thresholds:
  - color: '#00ff00'
    value: 0
  - color: '#fff000'
    value: 1
  - color: '#FFA500'
    value: 3
  - color: '#ff0000'
    value: 5
  - color: '#000000'
    value: 7
entities:
  - entity: sensor.fronius_grid_usage
    name: Grid Power
  - aggregate_func: min
    color: gray
    entity: binary_sensor.night
    name: Night Time
    show fill: true
    show legend: false
    show_line: false
    show_points: false
    show_state: true
    smoothing: false
    y_axis: secondary
hours_to_show: 72
name: Grid Usage
points_per_hour: 1
show:
  extrema: true
  labels: false
  labels_secondary: false
  smoothing: false
state_map:
  - label: Day
    value: 'off'
  - label: Night
    value: 'on'
type: 'custom:mini-graph-card'


Hi Marcus, thanks for your quick response.
I have added the tod platform in configuration.yaml, so that part is ok, but for the manual card I have issues when I try to add it, I get just errors, I am quite new to home assistant, I guess I am doing something wrong. Tried to copy and past the color_tresholds: part to the manual card config but that doesn’t really work…
Maybe you can give me a hint.
thanks