I did not find the problem why this trigger is not firing my automation:
alias: Löse alle 2 Minuten aus (Aktiviert nur bei Temp unter 10 und über 0 Grad)
trigger: time_pattern
enabled: >-
{{ states('sensor.obk0de01654_temperature')|float < 10 and
states('sensor.obk0de01654_temperature')|float > 0 }}
minutes: /2
He should fire each 2 Minutes, if the State is between 10 an 0 Degrees. At the Moment the temperature is at 7.7.
If I add this script in my developer Tools, I will get true as result.
{{ states('sensor.obk0de01654_temperature')|float < 10 and
states('sensor.obk0de01654_temperature')|float > 0 }}
If I remove the enabled statement, the Automation will execute each 2 Minutes.
The enabled field is normally used if you want to temporarily disable the trigger - then it would be either “true” or “false”. You need to put your template in the condition block.
The enabled option can only accept what is known as a “limited template” (only supports a subset of Home Assistant’s template extensions). In addition, a limited template is evaluated just once when the automation is loaded.
Your options are to follow what jackjourneyman suggested and keep the Time Pattern Trigger but move the template to a dedicated Template Condition.
alias: Löse alle 2 Minuten aus (Aktiviert nur bei Temp unter 10 und über 0 Grad)
triggers:
- trigger: time_pattern
minutes: /2
conditions:
- condition: template
value_template: >
{% set t = states('sensor.obk0de01654_temperature')|float(99) %}
{{ 0 < t < 10 }}
actions:
<your actions>
Alternately, replace the Time Pattern Trigger with a State Trigger (so it triggers only when the temperature actually changes).
alias: Aktiviert nur bei Temp unter 10 und über 0 Grad
triggers:
- trigger: state
entity_id: sensor.obk0de01654_temperature
conditions:
- condition: template
value_template: "{{ 0 < trigger.to_state.state | float(99) < 10 }}"
actions:
<your actions>
That’s a shame. That would have simplified the automation considerably, but I understand now
Do you perhaps have any ideas on how I can implement this automation most elegant?
alias: Poolpumpe zyklisch bei aktiver Poolüberwinterung laufen lassen
description: ""
triggers:
- trigger: time_pattern
hours: /1
enabled: "{{ states('sensor.obk0de01654_temperature')|float < 0 }}"
alias: Löse jede Stunde aus (Aktiviert nur bei Temp unter 0 Grad)
- alias: Löse alle 2 Stunden aus (Aktiviert nur bei Temp unter 3 und über 0 Grad)
trigger: time_pattern
hours: /2
enabled: >-
{{ states('sensor.obk0de01654_temperature')|float < 3 and
states('sensor.obk0de01654_temperature')|float > 0 }}
conditions: []
actions:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.poolsteuerung_isaver_einschalten
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.poolsteuerung_isaver_einschalten
mode: single
If the temperature is below 0 degrees, the automation should be triggered every hour; if the temperature is between 4 and 0 degrees, it should only be triggered every two hours. It should NEVER be triggered above 3 degrees.