Consumption sensor (which doesn't always reset to 0) to utility meter

I have an AEG washing machine, which I have added to HA using a HACS integration.

The integration supplies a sensor for the water consumption of the end of a cycle. The problem is, that the sensor apparently isn’t reset to 0 at the beginning of the cycle:

Looking at some of the data from here, I have:

sensor.aeg_vaskemaskine_appliancestate,Off,2024-04-17T22:00:00.000Z sensor.aeg_vaskemaskine_appliancestate,Running,2024-04-18T09:29:37.848Z sensor.aeg_vaskemaskine_appliancestate,End Of Cycle,2024-04-18T10:39:01.117Z sensor.aeg_vaskemaskine_appliancestate,Off,2024-04-18T10:43:54.178Z sensor.aeg_vaskemaskine_appliancestate,Delayed Start,2024-04-18T18:09:03.790Z sensor.aeg_vaskemaskine_appliancestate,Running,2024-04-18T23:06:57.495Z sensor.aeg_vaskemaskine_appliancestate,End Of Cycle,2024-04-19T02:24:37.065Z


sensor.aeg_vaskemaskine_fcmiscellaneousstate_waterusage,58,2024-04-17T22:00:00.000Z sensor.aeg_vaskemaskine_fcmiscellaneousstate_waterusage,0,2024-04-18T09:29:38.844Z sensor.aeg_vaskemaskine_fcmiscellaneousstate_waterusage,67,2024-04-18T10:39:01.118Z sensor.aeg_vaskemaskine_fcmiscellaneousstate_waterusage,93,2024-04-19T02:24:38.075Z

So - what I want to achieve is to have an utility meter, where I can sum up the total water consumption - but if 2 similar programs are run after each other (with 52L consumption), the water consumption sensor might not always be reset to 0 - which in the current situation might give me a reading of 52 - instead of 102.

I have tried to use automation with an input number - and trigger on the state of the washing machine (AEG/Electrolux water comsumption automation - - just to find out, that an input_number apparently cannot be used for an utility meter…

So - what I want to see, is when the washer goes from a non-Running state to Running - then the consumption should be considered as 0 … And when the state changes to “End Of Cycle”, the number in the consumption sensor should be used…

Any hints on how to do that ?

I have noticed, that the waterusage seems to be the last value top be set/update - so in order to ensure a correct value, maybe a delay is needed - so that when the appliance state changes from Running to End Of Cycle - then a delay of e.g. 200 msek (or 1 second) should be added - before actually reading the waterusage value …