hello,
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.
<?php
$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
<?php
$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:
sensor:
- platform: rest
resource: http://strom.mockerl.com/watt.php
name: WR_watt
# value_template: ''
unit_of_measurement: "Watt"
- platform: rest
resource: http://strom.mockerl.com/watth.php
name: WR_wattStunden
# value_template: ''
unit_of_measurement: "Watt H"