Possible to get count of times automation triggered today from history?

Could it be possible to dynamically fetch from HA history how many times certain automation has been triggered in period (specifically today)?
I know many are using input_number for that purpose but since this data is already present in history it should be more convenient and could avoid dealing with lost values of input_number during HA restart.

You could use a history statistics sensor to count that.

The value of the input_number is only lost if you’ve set the initial value - see the docs.

Thanks, it was exactly what I needed. Don`t know how I missed history statistics sensor in docs.

Anyways for other that may be interested - I ended up with following
Sensor:

- platform: history_stats
  name: Vacuum cleanups today
  entity_id: vacuum.servant
  state: 'cleaning'
  type: count
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

And automation:

- alias: Send Servant to dock when someone arrives home during repeated cleanup
  trigger:
    - platform: state
      entity_id: group.people
      to: 'home'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: vacuum.servant
        state: 'cleaning'
      - condition: template
        value_template: '{{ states.sensor.vacuum_cleanups_today.state | int > 1 }}'
  action:
    - service: vacuum.return_to_base
      entity_id: vacuum.servant