Skip to content

Add a configuration flag to support reducing the number of API calls#329

Open
francoisfernando wants to merge 5 commits intomacxq:mainfrom
francoisfernando:feature/reduced-api-calls
Open

Add a configuration flag to support reducing the number of API calls#329
francoisfernando wants to merge 5 commits intomacxq:mainfrom
francoisfernando:feature/reduced-api-calls

Conversation

@francoisfernando
Copy link
Copy Markdown

Why?

I recently installed a FoxESS battery with KH10 inverter in NSW, Australia. I also integrated my battery with a local VPP (Virtual Power Plant) provider/Energy Retailer which takes control of the battery.

Since I have a HA monitoring dashboard I also integrated using FoxESS HA plugin. But this lead to a problem as the combined API calls from VPP provider and HA plugin exceeded the 1440 API call limit per day. I really don't want to go the modbus route hence this little contribution to add a flag to run the FoxESS HACS plugin in a reduced api call mode.

What

Added a new boolean configuration flag reduceAPICalls which will reduce the main telemetry api calls frequency from 5 minutes to 10 minutes and also reduce other calls

Testing

FoxESS API has an endpoint to retrieve the number of API calls remaining and using this in a jupyter notebook I have measured my VPP provider is using about 45 API calls per hour. Since 1440 API calls translates to 60 API calls per hour this leaves about 15 API calls which can be used by FoxESS plugin. With the changes I have implemented when this flag is enabled, it will reduce the number of calls to about 13.

The following file is from measuring call counts over 2 hours with VPP provider only making API calls

call-counts-2025-12-19 12:35:19-2025-12-19 14:38:39.csv

@francoisfernando francoisfernando changed the title Add a configuration flag to support reduce the number of API calls Add a configuration flag to support reducing the number of API calls Dec 19, 2025
@FozzieUK
Copy link
Copy Markdown
Collaborator

Hi, as it stands this would break the code for solar only inverters as they shut down overnight and the integration checks the last data read timestamp to calculate age of sample - 10 minutes would break that, it's a relatively simple fix for that but let me have a think about it and make sure there are no other hidden gems..

@francoisfernando
Copy link
Copy Markdown
Author

Hi, as it stands this would break the code for solar only inverters as they shut down overnight and the integration checks the last data read timestamp to calculate age of sample - 10 minutes would break that, it's a relatively simple fix for that but let me have a think about it and make sure there are no other hidden gems..

Hi Dave, thanks for reviewing it; Happy to make any changes to not break solar inverters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants