Split total (home+garden) and garden counter config for energy dashboard

I have two water counters - one is installed directly on the incoming line (immersion pump) and the second one on the line that goes to the garden irrigation. Reason for this set-up is the utilities company that charges for waste water treatment. Every month I report both readings and get charged for the difference.

Both meters have reed switches installed and are connected to KNX input interface that acts as a separate pulse counter for each of them. Since KNX device does not support addition of some “offset” to the counted value, this is done with HA template, which just adds a numeric value to the KNX counter reader, so that HA entity shows same value as the dials on the physical meter.

So far so good, I can show in the dashboard a value that will be same as physical meter reading. I can also add them to Energy Water consumption, so that they are tracked there.

The problem is that Energy dashboards sums both of them together, which is incorrect - one of them already is the “total” water consumption. I could add another template that calculates the difference (indoor = total - garden), but there is a problem - this calculated “indoor” reading will sometimes report a decrease because actual pulses are not in sync. For example if I open garden tap, it is guaranteed that “garden” pulse counter will at some point get the impulse before before “total” pulse counter, which will result in a negative consumption for the calculated “indoor” value. Since the meters only report pulse for every 10L of water, this happens quite often.

Any ideas how to work around this?