Hi all, this should be simple but I am clearly missing something as this automation says it has never run and yet I can see the template evaluated to true for hours on one occasion. It is intended to warn of a power cut as we are on a home battery, so when the grid in / out senor is zero for 5 minutes that would qualify. the code is
platform: template
value_template: "{{ states('sensor.grid_power') == 0 }}"
for:
hours: 0
minutes: 5
seconds: 0
there are no conditions but the automation has missed several power cuts.
the whole automation is below
Any hints very gratefully accepted
Thanks in advance
alias: Warn if grid is off
description: ""
trigger:
- platform: template
value_template: "{{ states('sensor.grid_power') == 0 }}"
for:
hours: 0
minutes: 5
seconds: 0
condition: []
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.grid_failure
data: {}
- service: notify.mobile_app_pixel_6
data:
title: Grid Warning
message: No grid for 5 minutes - Needs checking
- service: notify.mobile_app_pixel_3a_xl
data:
title: Grid Warning
message: No grid for 5 minutes - Needs checking
mode: single