How to record set value on a template sensor anytime another binary sensor flips

I have a rain gauge sensor as a binary_sensor that briefly goes on then back to off for every 0.01193in of rain it records. I set my influxDB to record the binary sensor which just sends a 1 when it flips. Currently I have a query which multiplies 0.01193 for every row to give me total rainfall in a range of time, but I would rather it send 0.01193 to influxDB every time the binary sensor flips. I’m assuming you could have a sensor whose value is set to 0.01193 every time there is a flip…but how do I do that?

I feel overly perplexed on a simple solution to this…how can I create some kind of template sensor that record 0.01193 every time the binary_sensor flips?