Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105688

Error in 'template' condition

$
0
0

Hi,
In my automations, I often use the following condition to prevent the repetition of an action if the event occurred within a specific time frame (20 seconds in this case) since the last occurrence of the event.

conditions:
  - condition: template
    value_template: >-
      {{ (as_timestamp(now()) -
      as_timestamp(state_attr('automation.voice_and_video_alert_from_frigate',
      'last_triggered') | default(0)) | int > 20)}}

This condition worked for months, but a week ago it stopped working and now returns the following error message:

Errore: In 'template' condition: ValueError: Template error: as_timestamp got invalid input 'None' when rendering template '{{ (as_timestamp(now()) - as_timestamp(state_attr('automation.voice_and_video_alert_from_frigate', 'last_triggered') | default(0)) | int > 20)}}' but no default was specified

I’m not sure what the mistake is, especially since it has always worked before. Could you help identify the issue and suggest a solution?

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 105688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>