Ive had some PM requests for it as is so I might as well post it here for others to get started it is Python3 and requires the PVoutput module from https://github.com/yaleman/pvoutput I think you can install it with PIP… please NOTE this is just my first working hack at making it work from modifying the sample code from the above link and probably includes stuff you dont need and is probably missing stuff you do need please use at your own risk and is intended for people with some python experience. it just gets data from the Gen24 primo and dumps it on PVOUTPUT every 10 minutes just to see if the concept works. if you tweak the parameters it should work for the Fronius smart meter and multiple connected inverters that use the V1 API
You will need to change the ip address of the inverter, your API, and system ID
the lines you need to alter look like this
apikey="YOUR API KEY",
systemid=YOUR SYSTEM ID,
response = json.loads(requests.get("http://192.168.1.21/solar_api/v1/GetInverterRealtimeData.cgi").text)
import requests
import json
import asyncio
import aiohttp
import datetime
import asyncio
from pvoutput.asyncio import PVOutput
y = 0
response1 = json.loads(requests.get("http://192.168.1.21/solar_api/v1/GetInverterRealtimeData.cgi").text)
print(response1)
async def postPVoutput() -> None:
"""main function"""
# configuration = await get_apikey_systemid()
testdate = datetime.date.today()
#global CONSUMPTION
#if CONSUMPTION == 0:
# print("only just started dont send yet")
# return
response = json.loads(requests.get("http://192.168.1.21/solar_api/v1/GetInverterRealtimeData.cgi").text)
print(response)
energyGeneration = int(response["Body"]["Data"]["PAC"]["Values"]["1"])
print("Energy Generated: ", int(energyGeneration),"W")
data = {
"d": testdate.strftime("%Y%m%d"),
"v2": energyGeneration, # power consumption
# "m1": "Testing", # custom message
}
# print(CONSUMPTION)
# print(testdate.strftime("%Y%m%d"))
for attempt in range(10):
try:
async with aiohttp.ClientSession() as session:
pvo = PVOutput(
apikey="YOUR API KEY",
systemid=YOUR SYSTEM ID,
session=session,
donation_made="false",
)
response = await pvo.addstatus(data)
print("data")
print(data)
print(f"{response=}")
except:
print(response)
print("network issue")
continue
else:
break
else:
print("upload Failed")
#response = json.loads(requests.get("http://192.168.1.21/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DataCollection=CommonInverterData").text)
while True:
#print(datetime.datetime.now())
now = datetime.datetime.now()
# print(y)
t = (int(now.strftime('%M')))
#print(t)
if (t % 10) == 0 and t >= y + 1 or y > t:
y = int(now.strftime('%M'))
print("send data")
asyncio.run(postPVoutput())
I will continue to work tidying and testing