Reading Fronius inverters (Symo 15.0-3-M) with modbus binding

Hi,

I have read that most of the solar inverters implement a “sun-spec” for management over modbus.

Does anyone know how standardized this standard is and how closely Fronius follows this standard?

There seem to be multiple implementations (one with float values and one with “int + SF”. Also in my case I can choose to use rtu or tcp flavour for representation in the ip packets.

Do you know whether Fronius shares any documentation on their sun-spec-mod-bus-over-tcp implementation?

I saw People here reporting successfully using the modbus binding with solaredge inverters, but it looked like a “one configuration for one box” instead of “on configuration for all sun-spec”

Cheers

Assuming your inverter is connected to your LAN and you are interested reading values, I would recommend using their Solar API v1 which returns JSON messages.

Shop for your parameters in and pick a report (example uses GetPowerFlowRealtimeData).

Use the Paper UI to install Bindings->HTTP and Transformations->JSONPATH.

Edit conf/services/http.cfg adding these lines:

froniusCache.url=http://[yourInverterIP]/solar_api/v1/GetPowerFlowRealtimeData.fcgi froniusCache.updateInterval=5000
format=false

HTTP binding will ask the inverter every 5000 ms for the readings and cache results.

Edit your items/*.items file to refer to the cached URL and create the Items you want to see. For example:

Number PV_Current “PV Power [%.0f W]” { http="<[froniusCache:1000:JSONPATH($.Body.Data.Site.P_PV)]" }

If this is not your goal, then perhaps this document may be what you need:

http://www.fronius.com/Applikationen/contentserverdownload/downloadcsitem.aspx?id=361552

PS Sorry I’m new to openHAB so perhaps I did not follow the correct conventions above.

Hi Paul,

thanks. I don’t know why I was only looking at modbus. This JSON API and the documentation looks very promising. Thanks you

Thomas

Glad to be of help.

I’m just figuring stuff out as well being about a week into using openHAB having converted from Home Assistant. Seems less fluffy but more powerful. Not requiring re-start all the time makes progress less frustrating.

Note that you will be using JSONPATH (not JSON) http://docs.openhab.org/addons/transformations/jsonpath/readme.html

Also you cannot control the inverter with this method but can read just about anything.

Hi Paul,

before implementing in openHab i tried out with curl-command to be sure fronius is available.

$ curl -s --request GET --header “Content-Type=application/json” http://192.xxx.xxx.xxx/solar_api/v1/GetPowerFlowRealtimeData.fcgi

It works perfect.

Within openhab it looks like an http-error.

2017-05-14 15:25:44.334 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.lang.IllegalArgumentException: host parameter is null
at org.apache.commons.httpclient.HttpConnection.(HttpConnection.java:206)[57:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
at org.apache.commons.httpclient.HttpConnection.(HttpConnection.java:155)[57:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
at org.apache.commons.httpclient.SimpleHttpConnectionManager.getConnectionWithTimeout(SimpleHttpConnectionManager.java:175)[57:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)[57:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)[57:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)[57:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
at org.openhab.io.net.http.HttpUtil.executeUrl(HttpUtil.java:195)[189:org.openhab.core.compat1x:2.0.0.b5]
at org.openhab.io.net.http.HttpUtil.executeUrl(HttpUtil.java:130)[189:org.openhab.core.compat1x:2.0.0.b5]
at org.openhab.binding.http.internal.HttpBinding.getCacheData(HttpBinding.java:347)[190:org.openhab.binding.http:1.9.0.b5]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:160)[190:org.openhab.binding.http:1.9.0.b5]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:157)[189:org.openhab.core.compat1x:2.0.0.b5]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173)[189:org.openhab.core.compat1x:2.0.0.b5]

In case this is useful to anybody - below is a link to my Modbus configuration for reading data from a Fronius inverter.

how looks your sitemap ? I tried:
Text item=PV_Current label=“PV Leistung: [%s]” icon="none"
Showing only value without Text "PV Power " like defined in items
thank you (yes, i am a beginner)

I use http binding to read my fronius inverter (I’m still on OH1.8, but should be almost the same at OH2)
http-cache:

http:froniusrtd.url=http://pv.udo.lokal/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System
http:froniusrtd.updateInterval=30000

.items:

Number  PV_Current      "Aktuelle Leistung [%0f W]"     <inverter>      (PV,PV_Graf)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.PAC.Values.1)]" }
Number  PV_DaySum       "Tagessumme [%0f Wh]"   <inverter>      (PV,PV_Graf)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.DAY_ENERGY.Values.1)]" }
Number  PV_YearSum      "Jahressumme [%0f Wh]"  <inverter>      (PV)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.YEAR_ENERGY.Values.1)]" }
Number  PV_Total        "Gesamtsumme [%0f Wh]"  <inverter>      (PV)            { http="<[froniusrtd:30000:JSONPATH($.Body.Data.TOTAL_ENERGY.Values.1)]" }

tried sitemap:
Text item=PV_Current label=“PV Leistung: [%f]” icon="none"
getting: PV Leistung: 46.000000 :frowning:

Please use [%0f] or [%.1f] to get 46 or 46.0 as label…

can you tell me how I can make a rule to get each 5 seconds the update value shown in the basic UI from my PV_Current which is now a NUMBER value in my items.
thanks:
actual I have this in my default:
Text item=PV_Current label=“PV Leistung: [%.0f]” icon=“none”

when using http-cache, you will have to change the updateInterval (that is in msec), to retrieve the information every 5 seconds, but be aware that this will increase the load on openHAB, Fronius and LAN.
However, Basic UI will not update every 5 Seconds, and I doubt if the values delivered by Fronius are that accurate anyway.

ok, so with http-cache the basci UI is updated that interval I defined ?
In my items I defined 5sec. for getting data via http json object from inverter. I thought there is a rule necessary for updating it on the basic ui…

No, this is all done by openHABs “magic” :wink:

There is another update interval in the items definition (also set to 30000 msec) which also has to be changed to 5000msec, sorry, forgot that part in first place…

I have in my http.conf this:
froniusrtd.url=http://…
froniusrtd.updateInterval=5000
format=false

in items:
Number PV_Current “Aktuelle Leistung [%0f W]” (PV,PV_Graf) { http="<[froniusrtd:50000:JSONPATH($.Body.Data.PAC.Values.1)]" }

it does not refresh on the basic UI!

Should be

Number PV_Current “Aktuelle Leistung [%0f W]” (PV,PV_Graf) { http=<[froniusrtd:5000:JSONPATH($.Body.Data.PAC.Values.1)]" }

not 50000!

But I’m not sure if this would help anyway. As far as I know, the UI won’t update this fast.

Thank you for your help.
How Can I calculate (W in kwH) ?
I tried a rule:
rule "pv-berechnung in kWh"
when
Item PV_DaySum received update
then
var PV_DaySumCalculated = PV_DaySum/1000;
end

in sitemap I use PV_DaySumCalculated instead of PV_DaySum.

Rule shows error in log:
2017-11-25 13:51:13.380 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘pv-berechnung in kWh’: An error occurred during the script execution: The name ’ / ’ cannot be resolved to an item or type.

When updating the state of an item, you have to use either sendCommand or postUpdate, where the former will result in a command sent to every binding which is bound to the item and the latter only will change the state without sending this to the bindings.
So, the rule should be like

rule "pv-berechnung in kWh"
when
    Item PV_DaySum received update
then
    PV_DaySumCalculated.postUpdate((PV_DaySum.state as Number)/1000)
end

2017-11-26 11:23:02.335 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘pv-berechnun g in kWh’: An error occurred during the script execution: The name ‘PV_DaySumCalculated’ ca nnot be resolved to an item or type.
2017-11-26 11:23:32.322 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘pv-berechnung in kWh’: An error occurred during the script execution: The name ‘PV_DaySumCalculated’ cannot be resolved to an item or type.

Where do I have to initialize PV_DaySumCalculated and how ?
thanks,

You have to define PV_DaySumCalculated as an item in an .items file (same as the other items)
UIs do only display Items, so every value, which shall be displayed has to be stored in an item.

This item is not bound to any binding, so there is no {} part:

Number PV_DaySumCalculated  "Tagessumme [%.1f kWh]" <inverter>