Fronius inverter integration


I was asked on reddit to post my solution to integrate a fronius inverter into HA.
First of all a disclaimer: it’s not exactely an elegant solution, i frankensteined it together in one or two hours.

In the fronius there is an option to upload data to an ftp server.

i put the following php files in the same folder as the json file from fronius.

$str = file_get_contents('data.json');
$json = json_decode($str, true); // decode the JSON into an associative array

#echo '<pre>' . print_r($json, true) . '</pre>';

$watt = $json['Body']['PAC']['Values']['1'];
$day = $json['Body']['DAY_ENERGY']['Values']['1'];

echo $day;


this script echos the produced watts

$str = file_get_contents('data.json');
$json = json_decode($str, true); // decode the JSON into an associative array

#echo '<pre>' . print_r($json, true) . '</pre>';

$watt = $json['Body']['PAC']['Values']['1'];
$day = $json['Body']['DAY_ENERGY']['Values']['1'];

echo $watt;


this one picks and peints the currently produced watts.

in HA i used the following settings:


  - platform: rest
    name: WR_watt
#    value_template: ''
    unit_of_measurement: "Watt"

  - platform: rest
    name: WR_wattStunden
#    value_template: ''
    unit_of_measurement: "Watt H"
1 Like

Not sure if it depends on the datamanager card installed or the inverter user but this is how i got mine working

the /1000 in the value template brings the units into kWh but i cant seem to be able to round the figure to 2 decimal places (eg 1234.56), tried converting to an integer as above but that doesn’t seem to want to play nice either


i didn’t even know that there was an “inbuild api” in the converte. seems to be the more elegant solution.

as to the formating, you have to convert to something like float or double (you could probably even use dec?) otherwise it wont show any decimal places

Yup, go thtat working now, next iteration is to have a scrape tool that will pull the latest figure off the supplier’s website then feeds that into the calculations.

i have most of the outlets at the back of the house monitored now so need to group them into rooms etc so that stats can be logically arranged.

Is there a way for the group to total the figures output to that group? like the switch groups will switch every member of that group. For easy visual reference i’ll look at a limit of consumption per room and then get something to colour a background to show if it’s high or low

Hi Radebe2k
Did you manage to get this working, could you please post your config :slight_smile: Thanks in advance

Thanks Radebe2k.
I am using this, however if there is no sun, the inverter switches off and I get a lot of errors in my logging. Any ideas to make it more elegant?

not very elegant, but works:

    value_template: >-
      {% if is_state('sun.sun', 'above_horizon') %}
        {{ value_json.Body.Data.PAC.Value /1000 | round(1) }}
      {% else %}
      {% endif %}

Thanks tommi, that might help.
I am currently going a different route, and I am writing a custom sensor for it. But need to learn more about the internal of home assistant first.

You may have since discovered this…

There is a night mode setting you can turn on in the Inverter’s display settings (I have the Primo. Maybe not available in all of the inverter models?)

I will check that when everything is working again. The last storm blew away my panels :frowning_face:

Also note that (maybe only if you have a load-controller), this provides consumption data:


as value_json.Body.Data.Site.P_Load

as per

Maybe wrong place to ask, but what’s up with “Fronius symo component”
“status” is “closed” ? is it integrated already or not ? that can be gamechanger as I’m also with Fronius Symo here.

where is the return JSON file stored ?

I have no clue, but you can see the data returned as attributes of the rest sensor you applied the address to

fixed it , removed the .value after the P_Grid
now looks like …

platform: rest
name: “Grid power”
value_template: ‘{{ value_json.Body.Data.Site.P_Grid }}’
unit_of_measurement: “W”
scan_interval: 100

There is a better version based on pyfronius of this author. I think it is not integrated yet in HA, but you can install the component in your custom components. And that should work. I will try out soon myself.

Did you try it out? I installed pyfronius & put the file in custom_components but Im not sure how to configure it. Thanks

After you have this you should add the component to yor sensors

- platform: fronius
  host:    # ip address of your inverter
  type: inverter
  device: 1
  scope: device

Than there should be a sensor available called sensor.fronius_inverter_192xxxxxxxxx_1 Where the number (192xxxxxxxxx) is the IP address of the inverter without dots.Using templates you should then be able to access all the data from the inverter.

- platform: template
      unit_of_measurement: 'W'
      value_template: >-
        {% if states.sensor.fronius_inverter_192178XXXXXX_1.attributes.power_ac is defined %}
          {{ states.sensor.fronius_inverter_192178XXXXXX_1.attributes.power_ac | float | round(2) }}
        {% else %}
        {% endif %}

Somehow this does not work for me anymore, but it is supposed to work like that.

1 Like

Thanks for that. Doesn’t work for me either.

I guess the API will have to do for now

Any one have is working on there system. An any bad report, will anyone will reopen the project on GitHub