Logging pulses from a tipping bucket rain meter

I have connected a tipping bucket to a Z-wave door sensor (DRY sensor). When the bucket tips, it closes and opens the circuit, creating a “pulse”. I was afraid that this pulse was too short to be noticed by the Vision door sensor, but it works great.

Since one tip generates two state changes (from 255 to 0 and back again to 255) I wonder how to go forward.

I have now created an Automation that just sends a Pushover for testing. It works, it is sending one message for each pulse:
- alias: Tell tipping bucket
trigger:
platform: numeric_state
entity_id: sensor.vision_zd2102_au_doorwindow_sensor_alarm_level_2_1
value_template: ‘{{ state.state }}’
# Optional
below: 1
action:
service: notify.Pushovermelding
data:
message: ‘Bucket tipping’

(Sorry about the YAML chaos, I could not find a way to format it when posting here)

But I would like to log and count these pulses and eventually multiply it with the bucket volume to get the amount of rain.

How can I do this in Home Assistant? I expected this to be easy, but I cannot find a way to store the value.

You can probably just make a dummy sensor and then set the state with a template. Current + 1.