One other quick question, if I try and use this template in the trigger part of the automation it does not fire, why is that? (I use the disabled state trigger instead)
alias: Solar - 5 minute peak output today
description: Records the peak 5 minute continuous PV output today and the associated time
trigger:
- platform: state
entity_id:
- sensor.solar_pv_output_over_last_5_minutes
enabled: false
- platform: template
value_template: >-
{{ states('sensor.solar_pv_output_over_last_5_minutes') | float(0) >
states('input_number.solar_peak_5_minute_output_today') | float(0) }}
EDIT: Never mind, it seems to have started working now
It will only trigger if the template resolves true after resolving false. That means sensor.solar_pv_output_over_last_5_minutes has to be less than input_number.solar_peak_5_minute_output_today for an extended period before that trigger will fire.
Isn’t the first trigger useless anyway (despite it being disabled)? The template trigger already covers a state change of “sensor.solar_pv_output_over_last_5_minutes” . Or doesn’t it?