Automation Condition with time entity

I automated when a pool pump is switched on. Now I want to add a condition for this automation. With this I record how low the device was switched on today already:

sensor:
- platform: history_stats
    name: Dauer_Poolpumpe_Ein
    entity_id: switch.shelly_1
    state: "on"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

Now I want to add this entity to the automation as an condition. Only when this time value is below one hour, the automation should run. I tried it with condition “numeric state” and gave it the seconds for a below threshold, but it didnt work. Any ideas how that might work?

Thanks.

- condition: numeric_state
  entity_id: sensor.dauer_poolpumpe_ein
  below: 1
1 Like