#Can we use event templates as conditions?

1 messages · Page 1 of 1 (latest)

tame geode
#

Grok made me the following condition and im wondering if its valid:

value_template: >
  {{ state_attr('calendar.gelbe_tonne', 'start_time') is not none and now() >=
  (state_attr('calendar.gelbe_tonne', 'start_time') | as_datetime -
  timedelta(hours=12)) and now() <= (state_attr('calendar.gelbe_tonne',
  'start_time') | as_datetime + timedelta(hours=8)) }}

So this condition should pass if the calendar event is between 12 hours before it starts and 8 hours after.

Sounds right?

devout lotus
#

why don't you check it yourself?