Fronius inverter integration

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

You’ve probably already done it, but mini-graph-card is a custom component that needs to be installed:

Otherwise I am going to try this later today, I’ll see how I go too…

Awesome, thank you! Can you post the push service to pvoutput config on the inverter? I never could work that out properly.

yes I haev installed the mini-graph-card but had to restart the server, now it looks good. Do you know if I can set the timeinterval to update the figures so it will be shorter?

Sure.

And for house energy consumption (I think you need to be a paid donator to PVOutput for this to display)

Hi Delbz,

That’s a great view you have there.

I managed to setup the Energy and Grid Usage based on the codes you provided…

Are you able to provide the ‘Solar & Consumption’ and ‘Power’ cards as well?

Thank you in advance.

@Delbz, thanks for posting those inspirational views :slight_smile:
I started reworking my setup and used your views as base and so far ended up with this…still tweaking the setup.

Sure.

Solar and Consumption - Note I had to create a new sensor in configuration.yaml called ‘sensor.fronius_house_load_pos’ to display the ‘house load’ number as a positive - it’s negative by default.

sensor:
  - platform: template
      sensors:
        fronius_house_load_pos:
          value_template: "{{ (states('sensor.fronius_house_load') |float) | abs }}"
entities:
  - color: '#27ae60'
    entity: sensor.fronius_panel_status
    name: Solar Gen
  - color: '#e74c3c'
    entity: sensor.fronius_house_load_pos
    name: House Usage
    show_state: true
  - 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: Solar & Consumption
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'

and Power Card

inner:
  colors:
    - color: var(--label-badge-green)
      value: 4.5
    - color: var(--label-badge-yellow)
      value: 3
    - color: var(--label-badge-red)
      value: 0
  entity: sensor.fronius_panel_status
  label: Gen
max: 8
min: 0
outer:
  colors:
    - color: var(--label-badge-red)
      value: 5
    - color: var(--label-badge-yellow)
      value: 3
    - color: var(--label-badge-blue)
      value: 0
  entity: sensor.fronius_house_load_pos
  label: Using
title: Power (kW)
type: 'custom:dual-gauge-card'


Thanks mate. They all look great except for the sensor.energy_consumption which is constantly showing 0.0

Thank you so much for this, my pvoutput push is identical to yours but I can’t make sense of my pvoutput data. Does this look similar to yours?

This is todays data, I haven’t been home so my power usage certainly shouldn’t be 17kw

Solarweb:

PvOutput:

image

I really want to get that 13kWH export and 2.14 kWh import into HA so I can calculate power cost for the day. Does your solarweb data match pvoutput or am I reading this wrong? Thank you.

@dave122 Those figures look reasonable to me. Note that Solarweb Energy Balance chart only reports to the last hour so it’s often behind PVOutput. In summer my house uses 6-12 kWH from midnight to dawn depending on how much the AC has been running - so what you have makes sense. If you are importing your consumption into PVOutput you can easily calculate and see the daily costs.

Here’s mine from https://pvoutput.org/intraday.jsp?id=28907&sid=45948
$10.66 net cost for yesterday.

To see a daily report you select the “Show Generation/Export view” (The second square just above the word minimise in this screenshot).

Hi @safepay I have been using your Fronius custom_component since you released it, and its great, however I’m fairly sure the totals are incorrect. As you can see below, the values are huge given that they are set as MWh. I have had the system approximately one year
image

I’m thinking those values are actually supposed to be Wh, because dividing the total by 1M would give approximately 7.9MWh which works out to an average of 21kWh / day, which is what I see in the states:
image

Have you noticed this on your system?, or anyone else?

@sparkydave I just looked at this today as well and tried all kind of units and also believed that the integrations shows wrong. However if you look directly to your inverters api. In my case: http://192.168.0.3/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=1&DataCollection=CommonInverterData

You will see that it reports in Wh- So the integration shows correct. It just changes the unit. I suppose you and me want it to recalculate the totals if you switch to MVh. I does not do this now.

@planet4 @sparkydave
I have my setup set to convert to kWh and my sensor in HA shows correct values in kWh, not just that the unit is in kWh.

image

image

That said, i’m running my own fork that has some more changes in it. But I don’t think I have touched anything in this part.

Oh, you are running the latest released version using HACS right? If so then I think this conversion is actually broken for you. I submitted some fixes that are in master. But since there has not been any new release you will not get those fixes, unless you manually download the integration from github.

I just saw that @safepay has updated the repo so I have updated (via HACS) and will restart HA to see how it goes.

EDIT: looking good so far :slight_smile:

EDIT 2: the daily energy production value is now also in MWh which I think for most of us is too large. My daily is normally about 30kWh on a sunny day. It would be best to have the daily in kWh rather than MWh.