Automation threshold-fire-when-useful needed

HI,

i have an automation that works just fine when the outdoor temp is around the threshold i use in the automation.
Now the temp has arrived at spring levels finally, i don’t need it to fire anymore, until the temp goes down again to somewhere near the threshold value.
Maybe i need a from: to: statement? not sure how to implement this though with temp values.

please have a look how the adjust this so it only fires when useful…

- alias: Vijverpomp mag uit
  id: '1511601478445'
  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    below: 6
  condition: []
  action:
    service: notify.notify
    data_template:
      title: Vijverpomp mag uit
      message: De vijverpompen mogen uit want het is {{ states.sensor.temperature.state
        }} graden

- alias: Vijverpomp moet aan
  id: '1511601478446'
  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    above: 6
  condition: 
    condition: sun
    after: sunrise
#      after_offset: '+00:00:00'
  action:
    service: notify.notify
    data_template:
      title: Vijverpomp moet aan
      message: De vijverpompen moeten aan want het is dag en {{ states.sensor.temperature.state
        }} graden.

Sounds to me like this can be fixed by adding a “hidden switch”. If its below the threshold, the switch is flipped. The above threshold will then get a condition to only fire if this switch is flipped already, effectively stopping it from execution if the temp always stays above the threshold

would this be a solution:

  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    below: 6
  condition: 
    - condition: template
      value_template: "{{ '5' < states.sensor.temperature.state < '7' }}"

trigger only if the real temp is around the threshold area, and trend is going below 6…
seems there must be a standard sensor/trigger for this…

wouldn’t that effectively stop the Automation to fire if the Temperature is lower than 5?

yes, that what i want.
this is for my pool-pumps that only need to be on when temp is above 6. When temp is below 6 or above 6 I don’t need constant reminding it is. the automation need only to fire when the threshold is crossed either way. I have of course 2 automations… :wink:

other way round:

  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    above: 6
  condition: 
    - condition: template
      value_template: "{{ '7' > states.sensor.temperature.state > '5' }}"

Hope to only hear from it again next fall/winter…