Feb-24-2021, 02:05 PM
(Feb-24-2021, 01:58 PM)snippsat Wrote: Usually get json back as you data look like.
So like this,some style change and f-string advise to.
import requests inverter_local_ip = '192.168.XXX.XXX' inverter_data = requests.get(f'http://{inverter_local_ip}/solar_api/v1/GetPowerFlowRealtimeData.fcgi') json_data = inverter_data.json()If this work then data will now be a Python dictionary.
>>> json_data['Body']['Data']['Site']['P_Grid'] 650.5 >>> json_data['Body']['Data']['Site']['P_Load'] -4331.5
Thanks a lot! You saved my day!!!
Like that I can work with it perfectly!
import requests inverter_local_ip = '192.168.178.174' #Local IP of your Fronius Inverter inverter_data = requests.get('http://%s/solar_api/v1/GetPowerFlowRealtimeData.fcgi' % inverter_local_ip) #Retrieving data from your Inverter json_data = inverter_data.json() #print(inverter_data.text) #Displaying the retrieved data print(json_data['Body']['Data']['Site']['P_Grid']) print(json_data['Body']['Data']['Site']['P_Load']) print(json_data['Body']['Data']['Site']['P_PV'])