Automation trigger firing again

I have an automation for my shutter which has a template trigger based on temperature:

{{(states('sensor.weerstation_temperature') | float) > (states('input_number.rolluik_dicht_temp')| float)}}

And then in the action section it checks multiple things (with choose and conditions) but for simplicity let’s say that it only checks a binary sensor if the window is currently opened.
If the window is closed it closes the shutter, and of course if the window is opened it doesn’t and it notifies me about that.

Now my issue:
Say that the window was opened when the template above went to true. And the window was opened so I manually close the window.
It seems that the template trigger is not firing again so now HA is not closing my shutter.
The easiest for me would be that the template trigger is firing again and this time the window is closed so the shutter would go down. Or do I need to add a new trigger for when the window goes from open to closed ? (it would make the automation quite complex).

as far as I know that is the only way.

but then you also need to add the temperature sensor state to the conditions so the actions only run if the temperature requirement is also met.

you could possibly put all of your current conditions and trigger into a binary template sensor and then use that as the trigger so it only goes to true if all of those conditions are met and use that as the automation trigger instead.

Thanks. Or perhaps I should just move all the testing to the trigger template and have multiple named triggers like temp too high and window is open and another one like temp too high and window is closed.

A Template Trigger will trigger when its template’s result changes from false to true. It won’t trigger again until the result first changes back to false and then to true.

You might want to consider using a State Trigger to monitor the sensor and input_number and a Template Condition to compare their values.

alias: example
trigger:
  - platform: state
    entity_id:
      - sensor.weerstation_temperature
      - input_number.rolluik_dicht_temp
condition:
  - "{{ states('sensor.weerstation_temperature') | float(0) > states('input_number.rolluik_dicht_temp') | float(0) }}"
  - ... your other conditions ...
action:
  ... your actions ...

That could work in a situation like this because the temperature will likely fluctuate to some degree. So the automati9on would trigger again soon.

But not necessarily and especially if the OP wants the actions to occur as soon as, for example, the window closes and doesn’t want to wait for the temperature to change again.

But the general case still holds that if there are triggers that rely on conditions and the conditions changing would necessitate that the automation be re-evaluated then adding the conditions to the trigger is usually the only option.

Maybe the temperature is very stable and won’t change for an hour? At that point closing the window won’t cause the actions to run until that hour has passed and the temp reports a change.

I know you know all of this but I just wanted to make sure the implications of using a stateless trigger are understood.

Maybe but you will still need to use all those conditions to decide when or if the actions run so it only seems you are relocating the logic without really simplifying it.

But do whatever makes sense to you.

Thank you both for your explanations!!
I’m gonna try some of the options.