Use time of trigger from state in condition

Hi. I’m setting up a notification automation that’s supposed to run when a temperature is restored below a certain value. The purpose of it is to trigger when it returns below the threshold as below.

The issue is that sometimes the temperature naturally varies around the threshold temp and a notification isn’t necessary every time it swings a little bit above and then below. As it is now, even a few seconds at 10.1 degrees would set off the timer and eventually send a notification.

My thought was to use some time limit in a condition with {{ trigger.from_state.state }} such that it evaluates it that the trigger from state above 10 degrees must’ve lasted for x amount of time for this condition to be passed.

alias: normal_temp
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.t_1
    for:
      hours: 0
      minutes: 15
      seconds: 0
    below: 10
action:
  - service: notify.email_normal_temp
    data:
      message: test
mode: single

Is it possible to do, and if so any ideas how?

EDIT: I’ve now actually read and understood the question. Set up an input boolean (Toggle) helper, then:

alias: record high temp
trigger:
  - platform: numeric_state
    entity_id: sensor.t_1
    above: 10
    for:
      minutes: 15
action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.high_temp_flag

alias: normal_temp
trigger:
  - platform: numeric_state
    entity_id: sensor.t_1
    below: 10
    for:
      minutes: 15
condition:
  - condition: state
    entity_id: input_boolean.high_temp_flag
    state: "on"
action:
  - service: input_boolean.turn_off
    entity_id: input_boolean.high_temp_flag
  - service: notify.email_normal_temp
    data:
      message: test

Thanks for the quick reply. I should’ve perhaps mentioned that I already have a setup like that but the problem is when you start having larger numbers of sensors it becomes unwieldy to have too many inputs to keep track of.

Then maybe this will help:

Thanks. That would still require me to setup a separate threshold for each sensor I think. Preferably I’d like it to be in the condition of the initial automation to simplify it but if I can’t then I guess this is the way to go.