Automate sprinkler based on temperature only if it hasn't triggered in last 45min

I just want to check if I’ve created this automation correctly before i enable it and end up flooding my chook pen when i go to work tomorrow. :laughing:

The device is a tasmota flashed 8ch esp32 relay board which is now my irrigation/watering controller. It triggers various irrigation solenoids around the house.

My goal is to automate a sprinkler valve to my chook house.

Conditions are that if temperature is above 38°C then trigger sprinkler valve but only if it has not been triggered in the last 45 min. If the sprinkler has been triggered within the last 45min, then wait until 45min is up and turn sprinkler on and only if outdoor temp is over 38°C.

The sprinkler run time is set within tasmota using pulsetime as i also have a manual push button outside to also trigger the sprinkler. Its just a simple push the button, sprinkler comes on for pulsetime duration and then turns off.

I haven’t really played with automations a lot and still learning.

This is what i have come up with, could someone verify if I’ve gone about this the right way?

alias: Cool Chickens
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.gw2000c_outdoor_temperature
    above: 38
conditions:
  - condition: state
    entity_id: switch.tasmota_14
    state: "off"
    for:
      hours: 0
      minutes: 45
      seconds: 0
actions:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.tasmota_14
mode: single

Looks good - give it a go.

Bear in mind that triggers only fire once when the state changes - in this case when the temperature goes from 38 to 39. If the temperature stays above 38 it will not fire again - it would have to drop below 38 then rise again. I assume this is what you want?