Hello,
I’ve been using Home Assistant for a few weeks now and have already achieved a lot. Now I am trying to create a sensor in a template with a trigger that sets a timestamp depending on the previous numerical value. But I get the error
“Invalid config for ‘template’ at configuration.yaml, line 554: ‘conditions’ is an invalid option for ‘template’, check: conditions”.
I have seen here in the forum that there is a feature request to be able to use conditions here. Is there a way to create this configuration with the current Home Assistant version?
Many thanks in advance!
template:
- trigger:
- platform: numeric_state
entity_id: sensor.wohnzimmer_regenmesser_niederschlag
conditions:
- condition: template
value_template: "{{ trigger.from_state.state|float > trigger.to_state.state|float }}"
- condition: template
value_template: "{{ trigger.to_state.state|float = 0 }}"
sensor:
- name: Ende Niederschlag heute
unique_id: sensor.wohnzimmer_regenmesser_ende_niederschlag_heute
device_class: timestamp
state: "{{ now() }}"