Help with time/day specific value_template

I have a value template which indicates my recycling week (every other)… how could I get this to be time specific and only be true from Tuesday at 10am to Wednesday at 9am? It is displayed in a conditional card and only want it to be true at the times I would want it displayed.

value_template: "{{(as_timestamp(now())|timestamp_custom ('%U') | int % 2) == 1 }}"

I guess you could always create a binary sensor that’s only true during these times and use this as a conditional card indeed.

value_template: '{{ (now().hour >= 10 and as_timestamp(now()) | timestamp_custom("%a") == "Tue") or (now().hour < 9 and as_timestamp(now()) | timestamp_custom("%a") == "Wed")}}'

Thanks… this eliminates 3 automations and two input booleans :slight_smile:

1 Like