Hi there,
I'm an total beginner in python and currently experimenting with the request library.
I basically want to do a GET request to my local solar inverter to work with its data.
I already got that to work and received the following data:
I basically want to save the data behind "P_Grid" : 650.5, "P_Load" : -4331.5, and "P_PV" : 3681 into a variable to work with it.
I thought it would be quite easy but after searching for hours on the internet I couldn't find a solution. It shouldn't be that hard am I right?!
That is the simple code I'm getting the data from:
Thanks in advance!
Best,
Leo
I'm an total beginner in python and currently experimenting with the request library.
I basically want to do a GET request to my local solar inverter to work with its data.
I already got that to work and received the following data:
{ "Body" : { "Data" : { "Inverters" : { "1" : { "DT" : 105, "E_Day" : 20781, "E_Total" : 309730, "E_Year" : 309730.8125, "P" : 3681 } }, "Site" : { "E_Day" : 20781, "E_Total" : 309730, "E_Year" : 309730.8125, "Meter_Location" : "grid", "Mode" : "meter", "P_Akku" : null, "P_Grid" : 650.5, "P_Load" : -4331.5, "P_PV" : 3681, "rel_Autonomy" : 84.982107814844738, "rel_SelfConsumption" : 100 }, "Version" : "12" } }, "Head" : { "RequestArguments" : {}, "Status" : { "Code" : 0, "Reason" : "", "UserMessage" : "" }, "Timestamp" : "2021-02-24T14:26:59+01:00" } }Now the problem starts :) Although I see the data well displayed in my terminal I can't get it to save to a variable.
I basically want to save the data behind "P_Grid" : 650.5, "P_Load" : -4331.5, and "P_PV" : 3681 into a variable to work with it.
I thought it would be quite easy but after searching for hours on the internet I couldn't find a solution. It shouldn't be that hard am I right?!

That is the simple code I'm getting the data from:
import requests Inverter_Local_IP = '192.168.XXX.XXX' #Local IP of your Fronius Inverter InverterData = requests.get('http://%s/solar_api/v1/GetPowerFlowRealtimeData.fcgi' % Inverter_Local_IP) #Retrieving data from your Inverter print(InverterData.text) #Displaying the retrieved dataI hope someone can help me.
Thanks in advance!
Best,
Leo