Need assistance in code to reset a sensor value to 0

Hi,

I have a small weather station using ESphome, however I would like to reset the total rain (Pioggia).
I have seen that there is someway to add a button to reset a value but no matter what I do I cant get this to work.
I am new to Home assistant so if you can advise this will help me loads and it may be something simple like my understanding of the line sensor.integration.reset: my_integration_sensor.

My code for the sensor and button is as below.

sensor:
  - platform: pulse_counter
    pin: 23
    count_mode:
      rising_edge: INCREMENT
      falling_edge: INCREMENT
    unit_of_measurement: 'mm/per-min'
    name: 'Pioggia istantanea'
    id: Instant_rain
    filters:
        - multiply: 0.173


    total:
      unit_of_measurement: 'mm'
      name: 'Pioggia'
      id: Rain_total
      accuracy_decimals: 3
      filters:
        - multiply: 0.173
    update_interval: 5s  


button:
  - platform: template
    name: Total rain reset
    id: rain_reset_button
    on_press:
      then:
        - sensor.integration.reset: sensor.pioggia