Page 1 of 1
									
						Unable to get PV yield (todayYield) value using API call
						Posted: Wed Oct 29, 2025 3:57 am
						by sam2005
						I'm using the Fox API to retrieve today's PV yield, but the value returned doesn't appear to be correct.
I’ve tested two different API endpoints, and neither provided the expected data.
1. op/v0/device/generation — Excludes PV energy used for battery charging. 
For example, the total PV yield shown in the app was 25 kWh, but the API returned 21 kWh. I believe the missing 4 kWh was used to charge the battery.
2. /op/v0/device/history/query with the variable ["todayYield"] — It was empty:
    "errno": 0,
    "msg": "Operation successful",
    "result": [
        {
            "datas": [
                {
                    "unit": "kW",
                    "data": [],
                    "name": "Today’s power generation",
                    "variable": "todayYield"
                }
            ],
            "deviceSN": ""
        }
    ]
}
3. /op/v0/device/report/query It's doesn't match with app data.
Has anyone managed to get the Today's PV yield value from the API?
Thank you!
					 
					
									
						Re: Unable to get PV yield (todayYield) value using API call
						Posted: Wed Oct 29, 2025 8:21 am
						by Dave Foster
						The true PV production was only added recently to the OpenAPI, you need to use the report query "/op/v0/device/report/query"  with the variable ‘PVEnergyTotal’
Code: Select all
   reportData = (
        '{"sn":"'
        + devicesn
        + '","year":'
        + now.strftime("%Y")
        + ',"month":'
        + month
        + ',"dimension":"month",
        "variables":["feedin","generation","gridConsumption","chargeEnergyToTal","dischargeEnergyToTal","loads","PVEnergyTotal"]}'
    )
 
					
									
						Re: Unable to get PV yield (todayYield) value using API call
						Posted: Wed Oct 29, 2025 9:00 am
						by sam2005
						Thanks, Dave. It matches the app when the dimension is set to month, but when it's set to day, it's off by a few kilowatts.
 {
    "sn": "ABC123",
    "year": 2025,
    "month":10,
   "day": 26,
  "dimension": "day",
  "variables": ["generation","feedin","gridConsumption","chargeEnergyToTal","dischargeEnergyToTal","PVEnergyTotal"]
}
					 
					
									
						Re: Unable to get PV yield (todayYield) value using API call
						Posted: Wed Oct 29, 2025 9:05 am
						by Dave Foster
						We believe that the daily figures appear to be based on the 5 minute samples and it aggregates the values hourly which loses some resolution as it occasionally 'misses' a sample on the hour and at the midnight changeover which makes them un-reliable.
I always use month and then locate the index based on the day which matches the value in the app.
					 
					
									
						Re: Unable to get PV yield (todayYield) value using API call
						Posted: Wed Oct 29, 2025 11:41 am
						by tony.matthews1
						Have a look here (if you are using python) as you may find this easier: 
https://github.com/TonyM1958/FoxESS-Cloud
Many of the power variables, what they cover and what losses to expect is explained here: 
https://github.com/TonyM1958/HA-FoxESS- ... it-work%3F
When you get 'generation', the values returned are the output from the inverter, not the input, so this is not the parameter you are looking for.
As Dave says, when you get the stats, they are based on the inverter enegy counters that start at 0 when the inverter is installed and count up after that. Each of the snap shots reported is the difference in these counters between 2 times. The counters are sampled every 5 minutes. When you get the data for a day, it returns hours and each of the values is the difference between the first and last counter value in each hour. However, as the samples are every 5 minutes, this means the energy coverage is 55 minutes from each hour or 22 hours in a day rather than 24. As a result, the values do not add up to the correct value for the day.
To get the correct value, report the data for the month and select the day. This is difference between the first and last counter reading in the day so covers 23 hours and 55 minutes and is the value you see reported in the app.
If you use the python library above for reporting, it will return the hourly values and also the 'sum' of these. It also includes another element 'total' that is correct value for the day. You can use this to scale the hourly values to get an approximation for the day that will add up to the correct total.
If you query for PV power instead of pv generation, the library will get the 5 minute PV power samples and do the integration over the day for you to give an estimated 'kwh' for each power sensor. You can use this to get a good idea of the energy generated by indiviudal strings, for example, that Fox does not record.
If you want to record and track your data, I suggest looking at pvoutput.org, as described here: 
https://github.com/TonyM1958/HA-FoxESS- ... /PV-Output
You can use the python library above to generate data uploads for this.
 
					
									
						Re: Unable to get PV yield (todayYield) value using API call
						Posted: Wed Oct 29, 2025 11:26 pm
						by sam2005
						Thanks, Tony, for your detailed explanation. Much appreciated.
I have tried pvPower, but I couldn't get the correct value. For now, I'm happy to use the PVEnergyTotal value to upload to PVOutput, as it matches the app data. Also, I'm using the Android version of Node-RED to do this.
In the future, I'm planning to use a direct Modbus connection to get/set the inverter data and use Python code.