Annual Date Range Binary Sensor

Creates a binary sensor whose state is “on” between the defined start and end dates.

This can be used to define your own custom “seasons” to use as conditions for lighting effects, electricity tariffs, holidays, sports seasons, etc. Date spans that cross over New Year are supported.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  author: Didgeridrew
  homeassistant:
    min_version: 2025.10.4
  name: Annual Date Range Binary Sensor
  description: |
    Creates a sensor whose state is "on" when the current date is between two static dates.  Crossing the new year is supported.
  domain: template
  input:
    start_date:
      name: Start Date
      description: |
        Select the date you want to be the first day of your range.
        The resulting binary sensor will turn "on" at 0:00:00 on this date.
        The year will not be used for this binary sensor.
      selector:
        date:
    end_date:
      name: End Date
      description: |
        Select the date you want to be the last day of your range.
        The resulting binary sensor will turn "off" after 23:59:59 on this date.
        The year will not be used for this binary sensor.
      selector:
        date:
variables:
  _start_date: !input start_date
  start_l: "{{ (_start_date.split('-')|map('int',0)|list)[1:3] }}"
  _end_date: !input end_date
  end_l: "{{ (_end_date.split('-')|map('int',0)|list)[1:3] }}"
  crosses_year: "{{ start_l > end_l }}"
  current_l: "{{ [now().month, now().day] }}"
trigger:
  - trigger: homeassistant
    event: start
  - trigger: time_pattern
    hours: /12
binary_sensor:
  state: |
    {% if crosses_year %}
      {{ start_l <= current_l or current_l <= end_l }}
    {% else %}
      {{ start_l <= current_l <= end_l }}
    {% endif %}
  availability: "{{true}}"
1 Like

Template Blueprints are currently (October 2025) only available through YAML configuration. You can find more details about how to use them at:

HA Docs - Templates - Using Blueprints

Once you have installed the blueprint, use the following examples to help set up your own Sensors in your configuration files.


Configuration Examples:

template:
  - name: Twelve Days of Christmas
    unique_id: bp_12_days_xmas_0001
    use_blueprint: 
      path: Didgeridrew/annual-date-range-binary-sensor.yaml
      input:
        start_date: "2025-12-25"
        end_date: "2025-01-06"
template:
  - name: Halloween Lights Season
    unique_id: bp_halloween_days_0001
    use_blueprint: 
      path: Didgeridrew/annual-date-range-binary-sensor.yaml
      input:
        start_date: "2025-10-20"
        end_date: "2025-11-05"