Hi all
Now I have searched and search this forum and others and githubs for my answer but I just can’t get it to work properly
I am not a programmer I am just bumbling around the code with some Chat GPT AI help
This the equipment I have
RPI3 - RPIOS 32bit
Symo GEN24 10.0 3 phase
A fronius Smartmeter
Solar API on and verified - see below
Connection to my inverter on IP 192.168.0.76
I can see the data from my inverter when I poll this address
http://192.168.0.76/solar_api/v1/GetInverterRealtimeData.cgiScope=Device&DeviceId=1&DataCollection=CommonInverterData
I can see the data from the fronius smart meter when I poll this address
http://192.168.0.76/solar_api/v1/GetMeterRealtimeData.cgi?Scope=Device&DeviceId=0
This inverter is a new type so no menu to push the data in the firmware just the solar API.
I have been trying to interface the solar API with the pvoutput.org API with limited success
I have connected 3 times from a manual push using the below code but I don’t think I have all the right information.
I have been using this as my main code
Main Code
import requests
import json
from datetime import datetime
import pytz
Set the timezone to Melbourne, Australia
melbourne = pytz.timezone(‘Australia/Melbourne’)
Make the API call to get the data
url = “http://192.168.0.76/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceID=1&DataCollection=CommonInverterData”
response = requests.get(url)
data = json.loads(response.text)
Extract the relevant data from the response
power = data[“Body”][“Data”][“PAC”][“Value”]
energy = data[“Body”][“Data”][“DAY_ENERGY”][“Value”]
Get the current time in Melbourne
now = datetime.now(melbourne)
Format the date and time in the required format
date_str = now.strftime("%Y%m%d")
time_str = now.strftime("%H:%M")
Set the headers for the PVOutput API call
headers = {
‘X-Pvoutput-Apikey’: ‘THIS IS MY KEY - it is correct in my version’,
‘X-Pvoutput-SystemId’: ‘86587’
}
Make the API call to PVOutput
url = f"https://pvoutput.org/service/r2/addstatus.jsp?d={date_str}&t={time_str}&v1={power}&v2={energy}"
response = requests.get(url, headers=headers)
Print the response to check for errors
print(response.text)
But I don’t think it is getting all the data it should be as it is just over writing the last data sent to PVO instead of updating as per the table below.
Date | Time | Energy | Efficiency | Power | Average | Normalised | Temperature | Voltage | Energy Used | Power Used |
---|---|---|---|---|---|---|---|---|---|---|
28/01/23 | 5:45PM | 6.910kWh | 0.521kWh/kW | - | 0W | 0.000kW/kW | - | - | 0.000kWh | - |
28/01/23 | 5:40PM | 6.910kWh | 0.521kWh/kW | 0W | 0W | 0.000kW/kW | - | 238.0V | 0.000kWh | - |
28/01/23 | 4:30PM | 6.910kWh | 0.521kWh/kW | 0W | 0W | 0.000kW/kW | - | 239.5V | 0.000kWh | - |
28/01/23 | 2:05PM | 6.910kWh | 0.521kWh/kW | - | 0W | 0.000kW/kW | -1.0C | - | 0.000kWh | - |
28/01/23 | 2:00PM | 6.910kWh | 0.521kWh/kW | - | 0W | 0.000kW/kW | -1.0C | - | 0.000kWh | - |
28/01/23 | 1:30PM | 6.910kWh | 0.521kWh/kW | 0W | 0W | 0.000kW/kW | -1.0C | - | 0.000kWh | - |
28/01/23 | 1:10PM | 6.910kWh | 0.521kWh/kW | - | - | - | - | - | 0.000kWh | - |
Now I really want the following code to work that I found on GitHub from someone here in Melbourne and it has HA integration as well which I will also be investigating later on. So my question is help how can I install this code and have it upload to PVO every 5 mins. Remember you are talking to someone that is not tech savvy
Cheers