Daily Irrigation Statistics

Hi,

i have an irrigation coordination and i want to create a template to keep the daily statistics that the switch switch.irrigation_switch is on.

My template is not working:

sensor:
  - name: Irrigation Front Zone History
    state_class: total_increasing
    icon: mdi:sprinkler
    unit_of_measurement: m
    state: >
      {{ state_attr('switch.irrigation_switch', 'today_total') | float(0) }}

Can you help me please