Accessing 5 second updates through the API
Hi

Fairly new to Fox ESS and the API environment but looking for some guidance on how to access the high resolution/real time data coming from a Fox KH10 inverter.

I have a recently installed Fox KH10 and battery system, along with an Easee home charger. I'm trying to write a simple script to poll the Fox APIs for the current usage data (battery, solar, export, home load, etc.) and use the Easee APIs to limit the current that the car charger uses, the aim being to charge the car using only the excess generated by the solar, avoiding any import from the grid. In the normal course of events, the car would charge at ~32A, triggering a grid import.

I'm able to get the basic data I need from the API by calling /op/v1/device/real/query, but the granularity is around 5 minutes, which is a bit too slow for my use case. I've had the firmware on the KH10 updated to the current version (1.71/1.02/1.67) and read this would allow for 5 second updates. However the API only seems to update every 5 minutes, at least as per the timestamp at the end of the /op/v1/device/real/query query.

I started reading into the code in https://github.com/nicois/foxess-control, which suggests there's an undocumented websocket that can be used to pull in data with a 5 second update interval. Is this the only way to access 5 second interval data? Or should I be looking at the Fox Kafka option?

I'd also be happy pulling data directly from the KH10 over my home network but the data logger (WW) doesn't seem to be accessible locally.
Re: Accessing 5 second updates through the API
The datalogger sends data packets approx every 5 minutes to the Fox cloud servers, and accessing via the OpenAPI (or Fox private api) only provides access to that data.

As far as I know it wouldn't make any difference to the resolution accessing via Kafka, the fast updates are only provided on latest inverter firmware/dataloggers using a direct websocket connection with a very limited subset of the data necessary to draw the apps 'real time' data screen.

Best option to get 'reliable' and fast access to the inverter is using direct modbus connection by way of a wired RS485 adapter, I believe that WLAN (WW datalogger) should be able to allow direct access, on the H1 G2 WL (and H3 Smart) it definitely provides a modbus server - not sure about the KH, perhaps someone with direct experience can confirm that.
Re: Accessing 5 second updates through the API
Thanks Dave for the very quick response.

I'd be happy to try modbus but as far as I can tell using nmap, the WW/WLAN isn't running any services on the modbus port 502, only port 443. I'd heard that various firmware updates broke modbus but thought it was supposed to work in the latest release (2.05)

The websocket data looks to have what I'd need, so I guess it's refreshing at least a subset of the data every 5 seconds.
Post Reply