Does anyone have any idea how I could make a template to detect if a sensor number switches from 0 to anything positive or negative to anything positive?
I ended up using this;
- condition: template
value_template: "{{ (trigger.from_state.state | float <0) }}"
- condition: and
conditions:
- condition: template
value_template: "{{ (trigger.to_state.state | float >0) }}"
alias: example
trigger:
- platform: state
entity_id: sensor.whatever
condition:
- condition: template
value_template: >
{{ trigger.from_state.state | float(0) <= 0 and trigger.to_state.state | float(0) > 0 }}
action:
... etc ...