Fronius PHP Ultimate

Hi Guys, i modified a version of fronius PHP to give every option available from the API’s and to be able to work with or without three phase and the smart meter, added all configurable options at the top
Script located here https://github.com/B-Mqn/FroniusPHPUltimate

i have little to no coding experience and 0 PHP experience but after some trial and error i got the thing running pretty good its probably a little messy and has a few errors but still does what needs to be done.
if anyone can help me tidy up the code that would be great.

i have 1 question
B33st added $dataFile = and as i don’t have a meter hooked up yet i don’t know what it needs to be set as or what it does. anyone able to help?

also probably a question for @bankstownbloke
its uploading the data as
http://pvoutput.org/service/r2/addstatus.jsp?key=“My Key”&sid=“My SystemID”&d=20180922&t=20:57&v1=51130&v2=&v6=&v7=&v8=&v9=&v10=&v11=&v12=

if something else is uploading data to V6,V7, etc and this script is sending blanks (since nothing is configured for that extended data channel) will that overwrite or affect the other device’s data thats uploaded?

reused OP as i couldn’t delete it. so its updated ^^

Existing data will not be overwritten if empty is sent.

1 Like

@grannos look at using this for your dc string voltages

Thanks B-Man,

I should be able to adapt the PHP script to ‘suck’ out the MPP1 and MPP2 data from my inverter and push it to PVOutput.

At least with DC on the strings it’s easy enough to calculate the instantaneous power from V and I.

Cheers,
Walter

The Fronius API call /solar_api/v1/GetArchiveData.cgi which returns the MPP1 and MPP2 string data is quite deeply nested.

The relevant data are returned as tuples: ( TIME, V1 ), ( TIME, A1 ), ( TIME, V2 ) and ( TIME A2 ) where TIME is the number of seconds since midnight on the DATA queried. The TIME values display sorted alphabetically rather than numerically - The four tuples need to be combined into a single value ( TIME, V1, A1, V2, A2 ) before being uploaded…

My Computer Science degree predates PHP by quite a margin :slight_smile: so it will take a little longer than I’d hoped. I could write a Windows’ cmd script much quicker but my 24 x 7 machine is running Linux so PHP or Python would be a better long term option.

Array
(
[Body] => Array
(
[Data] => Array
(
[inverter/1] => Array
(
[Data] => Array
(
[Current_DC_String_1] => Array
(
[Unit] => A
[Values] => Array
(
[0] => 0
[10200] => 0
[10500] => 0
[10800] => 0
[11100] => 0
[11400] => 0

So ur saying you can pull the mppt data from the api?
What are you grabbing the archive data of volts and amps to get watts merging the amount of archives and then uploading as total watts for that mppt?

Hi B-Man,

I can pull the MPP1 and MPP2 data from my inverter using the API. I haven’t figured out how to extract and merge the select the most recent V1, A1, V2 and A2 values from the returned JSON and push it to PVOutout. The data are recorded by the inverter at 300s [ 5 minute ] intervals. To perform [ live ] 5 minutely updates to PVO the script would need to be time every 5 minutes commencing the sixth minute of the hour [ HH:06, HH:11, HH:16, HH:21 etc ]

So I am still beavering away…

can you screenshot the results you grab for the data.

extracting is easy just copy how its done in the php file already.

I have posted a copy of the script to github. Details in the thread listed below…