Fronius inverter integration

In addition to the two graphs I posted earlier in this thread I have also added this where I am color coding the background depending on certain conditions for the daily energy.

  • Total consumption, will be green if it is less than what has been sold.
  • Solar panels, will be green if it is higher than the total consumption.
  • Bought energy, will be green if it is currently exporting power to the grid.
  • Sold energy, will be green if it is more than what has been bought.

This is on an iPad we have in the kitchen that everyone can look at. The goal is to try to make it easy to see the current energy state in the house and hopefully make us more aware of how much energy we are consuming :slight_smile:

Together it looks like this:

@nilrog Thanks. I have not really been able to figure out exactly what they were. What I have tried and really would like to have is to

Calculate the exported kWh to grid per day - Right now I can only get the solar per day production via the API. In solar.webb you can seee this. They mention that you could connect to the webb api but have not seen that anywhere.
I have used so many templates so I am staring to get confused. Maybe someone have something that is working to share. Some valuses that you wont get from the api or the fronius integration.

Yeah, the explanation in the API for those two are not crystal clear :stuck_out_tongue:

I have all my solar stuff in a package file in HA. And I have also added a bunch of integration/utility sensor to give me totals per day and month for that which you cannot get from the live API. Unfortunately while upgrading to v0.106.4 some of those sensors got crazy and added the current state on top of the “last known state” at every restart, and on top of that did not reset when we went from February to January :frowning:

I’m also pulling some “max” values back from influxdb so that I can see peek power production per day/week/total.

I have also added a couple of sensors from the smartmeter API to this integration so that I can get a reading of voltage/current per phase on the AC side. This can be used to track how you are utilizing the fuses and could tell you if you could get by with smaller fuses. But that I haven’t cleaned up and sumbitted a pull request for yet.

I’m trying to keep all of this to using “in-house” data from the inverter. I do not want to rely on anything in the cloud for what I have in HA. And when it comes to Fronius, we have it all in the inverter so there is no need to go to SolarWebb.

What I still need to setup is something that can pull, or have it pushed from the inverter, data from the archive API so that I could generate some nice graphs based on “true” data and not what I have used HA to try to calculate based on snapshots every 30 secs. But I haven’t had time to look into that yet, nor have I found something good that someone else has made, that doesn’t rely on a third-party cloud service like pvoutput.

Great. Looks exactly what I am looking for. Would you be able to share? Lovlace cards and some sensor templates? I started to look at this last year but now when the sun is shining here in Gothenburg it would be nice to finalize this. I have written some of my work at www.planet4.se

Or is your github repo updated? I can have a look at the configuration there? Exept the lovelace cards.

@planet4 I don’t have my config in GitHub. But I have uploaded my solarpanels.yaml package file and the lovelace view as gists that you can look at. Bear in mind that I am using some sensors that do not exist in the Fronius integration that is published on HACS.

PS: I have read the stuff you posted on your site last year when I was preparing all this…and had to fix the installation of the smartmeter that the electrician failed to do properly. Although I never used any of your code since there are now two integrations that can talk to the inverter I got much inspiration from it :slight_smile: DS.

2 Likes

@Fredrik would you mind to share your config for Modbus? I have trouble to get proper values from my inverter. To be honest I am not very deep into Modbus and don’t know jhow to address the registers. I read the manual from Fronius where they explain Modbus and also the registers, but I am not smart enough to understand .-(
Would be really nice if you could provide the config with all the registers and templates you are using.
Thanks a lot!

Well, I am not really using modbus directly but the smartmeter is communicating with the inverter via modbus. Fronius has documentation about this. You should be able to get all the data via the inverter. I wrote here how mine was configured. You will have to use google translate as i wrote in swedish.

Like this

@Fredrik thanks for that, I will read and translate, however, I am working for a swedish company, but by swedish language skills are really poor. Glad that google translate exists :slight_smile:

@nilrog
Looks great! How did you get the additional sensors from your Fronius inverter like “sensor.fronius_smartmeter_current_ac_phase_1”

@dietlman Thanks! :slight_smile:

All those sensors with “smartmeter” in the name only exists in my fork of this integration. I haven’t had time to prepare a pull-request for that part. But I should do that. I have been running that code since November without any issues.

Also, you need a Fronius SmartMeter to be able to get to those sensors.

These are all the values that is possible to aquire from that API:

"0" : {
/* older devices do not support any detailed information */
"TimeStamp" : 1406816001 ,
"Enable" : 1,
"Visible" : 1,
"PowerReal_P_Sum" : -834.13,
"Meter_Location_Current" : 0,
"PowerReal_P_Phase_1" : -261.86,
"PowerReal_P_Phase_2" : -296.26,
"PowerReal_P_Phase_3" : -276.01,
"PowerReactive_Q_Sum" : 489.34 ,
"PowerReactive_Q_Phase_1" : 169.63 ,
"PowerReactive_Q_Phase_2" : 158.39 ,
"PowerReactive_Q_Phase_3" : 161.32 ,
"Current_AC_Phase_1" : 1.43,
"Current_AC_Phase_2" : 1.522 ,
"Current_AC_Phase_3" : 1.44,
"Voltage_AC_Phase_1" : 233.1 ,
"Voltage_AC_Phase_2" : 234.4 ,
"Voltage_AC_Phase_3" : 233.8 ,
"Voltage_AC_PhaseToPhase_12 " : 404.9 ,
"Voltage_AC_PhaseToPhase_23 " : 405.5 ,
"Voltage_AC_PhaseToPhase_31 " : 404.3 ,
"Frequency_Phase_Average" : 50,
"PowerApparent_S_Sum" : 967,
"PowerFactor_Sum" : 0.86,
"PowerFactor_Phase_1" : 0.83,
"PowerFactor_Phase_2" : 0.88,
"PowerFactor_Phase_3" : 0.86,
"EnergyReal_WAC_Sum_Produced " : 33989 ,
"EnergyReal_WAC_Sum_Consumed " : 1365,
"EnergyReactive_VArAC_Sum_Produced" : 4020,
"EnergyReactive_VArAC_Sum_Consumed" : 204310 ,
"EnergyReal_WAC_Plus_Absolute " : 1365,
"EnergyReal_WAC_Minus_Absolute " : 33989
},

And out of all of those I have chosen to add the following ones to the integration:

    'smartmeter_current_ac_phase_one': ['smartmeter', False, 'Current_AC_Phase_1', 'SmartMeter Current AC Phase 1', 'A', False, 'mdi:solar-power'],
    'smartmeter_current_ac_phase_two': ['smartmeter', False, 'Current_AC_Phase_2', 'SmartMeter Current AC Phase 2', 'A', False, 'mdi:solar-power'],
    'smartmeter_current_ac_phase_three': ['smartmeter', False, 'Current_AC_Phase_3', 'SmartMeter Current AC Phase 3', 'A', False, 'mdi:solar-power'],
    'smartmeter_voltage_ac_phase_one': ['smartmeter', False, 'Voltage_AC_Phase_1', 'SmartMeter Voltage AC Phase 1', 'V', False, 'mdi:solar-power'],
    'smartmeter_voltage_ac_phase_two': ['smartmeter', False, 'Voltage_AC_Phase_2', 'SmartMeter Voltage AC Phase 2', 'V', False, 'mdi:solar-power'],
    'smartmeter_voltage_ac_phase_three': ['smartmeter', False, 'Voltage_AC_Phase_3', 'SmartMeter Voltage AC Phase 3', 'V', False, 'mdi:solar-power'],
    'smartmeter_energy_ac_absolute_plus': ['smartmeter', False, 'EnergyReal_WAC_Plus_Absolute', 'SmartMeter Energy AC Absolute Plus', 'Wh', 'energy', 'mdi:solar-power'],
    'smartmeter_energy_ac_absolute_minus': ['smartmeter', False, 'EnergyReal_WAC_Minus_Absolute', 'SmartMeter Energy AC Absolute Minus', 'Wh', 'energy', 'mdi:solar-power'],
    'smartmeter_energy_ac_consumed': ['smartmeter', False, 'EnergyReal_WAC_Sum_Consumed', 'SmartMeter Energy AC Consumed', 'Wh', 'energy', 'mdi:solar-power'],
    'smartmeter_energy_ac_sold': ['smartmeter', False, 'EnergyReal_WAC_Sum_Produced', 'SmartMeter Energy AC Sold', 'Wh', 'energy', 'mdi:solar-power']

With these sensors you could then monitor the power outage on each phase and see if you could use a lower fuse, and possibly save some money. And you can see exactly how much power that has passed the meter and compare it with the electricity bill.

Hi @nilrog, thanks for your answer and explaining how you get the values. I have a smartmeter of course properly connected as I also have a Fronius Battery attached and control my water heating boiler from with the fronius inverter.
Howerver, I still do not understand how you get that sensor called “smartmeter” in your HA.
In your configuration you have the option “smartmeter = ture” which I had to remover because if I check configuration then I get an error that the option “smartmeter” is an invalid option. I am a bit confused to be honest. Would be very nice if you could eplain that to a noob.:wink:

@dietlman You need a version of the integration that only I have at the moment :slight_smile:

But I will try to prepare a pull request tonight and ask @safepay if he can take it in and do a new release of his integration. I will post here again when I have it ready.

aha ok now I understand that is a special version of integration that explains why the “smartmeter” parameter is an unknown option in my integration.
Ok would be great to have that as well, looksing forward to use it once it is approved by @safepay
thanks a lot guys for that great work, I really apreciate

Pull-request has been created now:

1 Like

Hi Fredrik, could you please explain this calculation to me? Where does the 15.3 come from?

15.3 is the kW§ of my panels. the maximum effect that I might be able to use in theory if all panels were producing 100%.

Ah ok, thanks. What size inverter do you have then?

@nilrog Thanks for sharing. I have rewritten most of my sensors now and are staring to get somewhere.

I know you are usiing some sensor that are not in HACS but still I am curious how you use:

smartmeter: true (in the fronius integration)

And this sensor that were in some lovelace cards. (sensor.fronius_smartmeter)

I will write something about my setup when I am done on my blog. Would it be ok to use and share some of your cards and sensors?

Thanks! :slight_smile:
You are welcome to use my stuff on your site as you see fit. I once had an idea of cleaning up my package file and posting it somewhere for others to look at. But I do not have time to publish anything myself apart from the activity here. So go ahead…and I will see what I can borrow from you when it’s published on your site :stuck_out_tongue:

This just enables the creation of 10 new sensors that are read from the “meter” API in the inverter.

smartmeter: true

And when that is done I just use them in lovelace right now. It’s just so I can see them. I haven’t yet thought about if/how to use them in a better way.

The smartmeter stuff has been merged to master. But it is still not in a release. I think @safepay wants some positive feedback before making a release. So if you want to try it out you can do a manual clone from github, replace your version from HACS, and try it out. And if it works for you you can post back here or in the pull-request that it works fine.

When you configure the smartmeter you may need to specify also the smartmeter_device_id depending on your setup. I think it will always be 0 in a fresh setup with only one meter. But I have no proof as I have only looked at my own setup.

But try first with only the first line. If your new sensors show up with valid values you are all set. If not then you can use this URL and check with device id your smartmeter has.

http://ip_address/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System

And then add this second line to your config with the number it has in your system.

smartmeter: true
smartmeter_device_id: <your smartmeter id>