I copied this code from another post and modified it to run correctly in Developer Tools → Template. It returns true or false depending upon the last triggered time is greater than or less than 21600.
But, in the automation itself, when I create a Condition → Template and paste this exact line in Value template box and press the Test button, it throws an error. The purpose of this condition is to prevent automation from running if it has been run in the past 6 hours.
{{(as_timestamp(now())) - as_timestamp(state_attr("automation.reboot_router_on_malfunction","last_triggered")) | default(0) | int > 21600}}
I have tried various combinations of whitespaces, single quotes vs double quotes, tried pasting it in YAML directly: nothing works in Value template. What am I doing wrong?
Thanks…