Run Automation on Big Sensor Change

I am using an Android load cell configuration to report raw weight via MQTT. This is a scale that goes under my kegs. I’m using a API to trigger when I pour a beer and report the amount of beer poured based off of the change in weight. I feel like I’m missing something, so I’d like another eye on this!

The Arduino reports every 30 seconds via MQTT.

I take the raw weight data, subtract the weight of the scale and empty keg and BOOM! ya got your weight of the beer. Awesome right? Welllllll… kinda. The weight is creeping on me, as load cells tend to do.

Load cells be creepin’

To combat this, I have an idea to only capture the change in weight when a beer is poured. The LARGE drop there.

To do so, I have set up a statistic sensor:

    name: "Tap 1 ML Poured"
    entity_id: sensor.tap_1_hx711_weightraw
    state_characteristic: change_sample
    sampling_size: 2
    precision: 1

I then have an automation that runs when sensor.tap_1_ml_poured is greater than 50 (I’m not pouring less and that filters out the noise), captures the most recent statistic data, and puts it into the API as ml poured.

Is there a better way I could do this? I haven’t tested extensively, but I would imagine if I happen to be pouring during an MQTT update, it may give some odd data?

What am I missing? Can anyone think of a better way to only capture the difference in large drops of a sensor, while ignoring the creep and the small fluctuations?

Thank you!