Trigger template based on multiple logic conditons

How would you write a trigger template to check an initial logic condition then if that matches check for another logic condition exactly a minute later. If both logic conditions match then fire the trigger?

Here’s the existing trigger template with initial logic condition:

platform: template
value_template: |-
  {{states('sensor.device_04_power')|int  < 260 and
  states('sensor.device_04_power')|int > 20 }}
for:
  hours: 0
  minutes: 2
  seconds: 0

This works great however I’m struggling to add the additional logic to check a second condition exactly a minute later. I want to check if the power value is 0 exactly one minute after the previous logic condition has been met - so at minute three check if power is at 0. Please note that reversing the logic checks will not fulfil my requirement i.e when power at 0 then check if power was between X and X for the previous two minutes. Any help gratefully received.

I don’t think there’s any way to do it all in one piece. You’ll need to use the action block to set a delay and condition.

trigger:
  - platform: template
    value_template: |-
      {{states('sensor.device_04_power')|int  < 260 and
      states('sensor.device_04_power')|int > 20 }}
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition: []
action:
  - delay: 60
  - condition: template
    value_template: "{{ states('sensor.device_04_power') | int == 0 }}"
....

EDIT: corrected typos mentioned below

Many thanks - this works perfectly following a couple of tweaks. Anyone else using this - you just need to remove a space between ‘int’ and ‘==’ and remove the bracket after ‘0’.