Intermittent automation template error

When you use as_timestamp() and it's unable to convert the value to a timestamp, it will report whatever default value you provided. However, you didn't provide a default value for as_timestamp() and that's why it reported a template error.

For more information, refer to petro's helpful post explaining which functions/filters require a default value.

In addition, it's preferable to use state_attr() to get an attribute's value. Refer to the Warning posted in the Templating section of the documentation.