Don't have access to the game right now, but can we link refineries and read the "amount in Output container"? Wanted to try that out all the last days and keep forgetting it...
Edit: damn not really... Could though set up a machine with maintain at just the cutoff point you want to check and read its state though.
Also for people asking for Lua resource, you can find it in-game or on
https://dual.sh/codex/