Dynamic jsonpath request for Fronius MPPT data

Hi!

I need some help getting data from my Fronius inverter.
The Fronius json API seems to be working very well. However not all inverter data is available from “static” request commands. To get data regarding e.g. the individual MPPT string (current and voltage) I have to query the historical data source which means I have to add a time span to the request command.

More specifically the following command fetches the measuring value within the last 5 minutes:

http://INVERTER_IP/solar_api/v1/GetArchiveData.cgi?Scope=System&StartDate=2019-10-29T10:05:00+01:00&EndDate=2019-10-29T10:10:00+01:00&Channel=Current_DC_String_1&Channel=Current_DC_String_2&Channel=Voltage_DC_String_1&Channel=Voltage_DC_String_2

Notice the 5 minute span in the request. The datalogger in the inverter seems to be working with 5 minute resolution, at least regarding archive data.

I’m thinking that if I query the so called “ArchiveData” every 5 minutes and somehow time shift the value with 5 minutes I can store a lot more data then what is available from the static requests.

Is this strategy feasable and if so could someone please help me in the right direction in reagards of constructing a rule where the time span is defined as “now minus 5 minutes”. A CRON trigger could then initiate the request every 5 minutes

Output from the request:

{
"Body" : 
{
	"Data" : 
	{
		"inverter/1" : 
		{
			"Data" : 
			{
				"Current_DC_String_1" : 
				{
					"Unit" : "A",
					"Values" : 
					{
						"0" : 4.2800000000000002
					},
					"_comment" : "channelId=66050"
				},
				"Current_DC_String_2" : 
				{
					"Unit" : "A",
					"Values" : 
					{
						"0" : 2.7600000000000002
					},
					"_comment" : "channelId=131586"
				},
				"Voltage_DC_String_1" : 
				{
					"Unit" : "V",
					"Values" : 
					{
						"0" : 326.30000000000001
					},
					"_comment" : "channelId=66049"
				},
				"Voltage_DC_String_2" : 
				{
					"Unit" : "V",
					"Values" : 
					{
						"0" : 647.20000000000005
					},
					"_comment" : "channelId=131585"
				}
			},
			"DeviceType" : 123,
			"End" : "2019-10-29T10:09:59+01:00",
			"NodeType" : 97,
			"Start" : "2019-10-29T10:05:00+01:00"
		}
	}
},
"Head" : 
{
	"RequestArguments" : 
	{
		"Channel" : 
		[
			"Current_DC_String_1",
			"Current_DC_String_2",
			"Voltage_DC_String_1",
			"Voltage_DC_String_2"
		],
		"EndDate" : "2019-10-30T10:09:59+01:00",
		"HumanReadable" : "True",
		"Scope" : "System",
		"SeriesType" : "Detail",
		"StartDate" : "2019-10-29T10:05:00+01:00"
	},
	"Status" : 
	{
		"Code" : 0,
		"ErrorDetail" : 
		{
			"Nodes" : []
		},
		"Reason" : "",
		"UserMessage" : ""
	},
	"Timestamp" : "2019-11-04T08:56:06+01:00"
}
}

Thanks!

  • Platform information:
    • Hardware: Raspberry Pi 2 B
    • OS: Openhabian v1.5-532, Raspbian GNU/Linux 9 (stretch)
    • Java Runtime Environment: openjdk version “1.8.0_152”
    • openHAB version: 2.4.0-1
  • Peripheral equipment: Fronius Symo 8.2-3-M with power meter

You can use the HTTP binding to update a string Item every 5 minutes

It’s a JSON string
Easy to get the info out of it using the JSONPATH transform in the binding

Yes thats exactly what I’m doing, works great.

So by your response I interpret it as it should be a feasable strategy.
The question now is how do I construct the rule needed?

I’m not fluent in rules scripting but the following pseudo code should work I guess. I’ll give it some effort.

timeSpanStart = time.now.minus.minutes(5).toString
requestString = constantString1 + timeSpanStart + constantString2 + time.now.toString + constantString3 

val newValue = transform("JSONPATH", requestString)

NumberItem.postUpdate(newValue)

Another question.
Would it be possible to persist a value to an earlier timestamp? I would like to store it in rrd4j and Influx.
Or is it more convenient, or even possible, to somhow adjust the presented time axis with a time offset.

Looks ok but you can use dynamic requests here: HTTP - Bindings | openHAB

You can also build the url string as is you pseudo code and use the sendHttpRequest action

No