I currently have this Value template to make automation only run between October and March.
{{ now().month >= 10 or now().month <= 3 }}
However, I now realized I need to change this to include October 1 to March 15 instead. How can I do this?
I currently have this Value template to make automation only run between October and March.
{{ now().month >= 10 or now().month <= 3 }}
However, I now realized I need to change this to include October 1 to March 15 instead. How can I do this?
{% set start = now().replace(day=1, month=10).date() %}
{% set end = now().replace(day=15, month=3).date() %}
{% set low, high = [start, end] | min, [start, end] | max %}
{% set current = low <= now().date() <= high %}
{{ not current if start > end else current }}
This works with any start or end date
{% set t = (now().month, now().day) %}
{{ t >= (10, 1) or t <= (3, 15) }}