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.