Add Christmas Season Sensor
This commit is contained in:
@@ -2,7 +2,15 @@
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Holiday Sensors
|
||||
|
||||
template:
|
||||
- binary_sensor:
|
||||
# Christmas Season is the day after Thanksgiving through New Years Eve
|
||||
- name: Is Christmas Season
|
||||
state: >
|
||||
{% set xmas_start = as_datetime('%.4d-11-%.2d'|format(now().year, 22 + (3 - as_datetime(now().year|string + '-11-01').weekday()) % 7 + 1))|as_local %}
|
||||
{% set xmas_end = as_datetime('%.4d-01-01'|format(now().year + 1))|as_local %}
|
||||
{% set today = as_datetime('2023-01-01T00:00:00')|as_local %}
|
||||
{{ xmas_start <= today and today < xmas_end }}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Holiday Automations
|
||||
|
||||
Reference in New Issue
Block a user