HA automation condition to support date ranges

As per https://github.com/home-assistant/core/issues/24317, attempted to outline requirements for hass to support date ranges in the built-in automation.

As github issues are not for enhancements, moving here:

Component/platform:

Description of problem:

The conditions allow for sun level, time, etc; but no “date range”.

Use Case (0): Basic Date Ranges
, consider a permanently installed receptacle/switch where the user wants to activate it (ON/OFF) at specific time(s) in the day, but ONLY between certain date ranges in the year.

Use Case (1): Seasonal Re-purposing
, I have a seasonal outdoor switch on zwave; in the summer it shall control a water fountain, in the winter it shall control exterior Winter holiday season lights
(i’d like to be able to program HA once for the summer season ranges, and winter time; then if the switch exists, the automation for the appropriate action/times will apply)

Use Case (2): Electrical Utility peak/off-peak seasonal changes
, consider we wish to program certain devices OFF during peak-electrical times; this can be satisified by time conditions, EXCEPT if your utility changes peak times by season. Consider: https://www.wnhydro.com/en/your-home/time-of-use-rates.asp.
(in a perfect world utilities might expose APIs, which would render a separate enhancement to build a “electrical-time-of-use” component similar to https://www.home-assistant.io/components/workday/) - but in the absence of that, the user could program semi-annually their date ranges to match the time-of-use seasonal changes.

Use Case (3): Basic Date Listings and Patterns
, what if a user would like the “1st of every month” or “every other week” or etc?
(not currently in scope)

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

  • extend for date?
    , of note, it already has a subsequent weekday filter; so extension for date-range seems reasonable

Additional information:
Feature Suggestion / Idea
(open to implementing myself, would look for stakeholder agreement to the idea first)

Requirements

PROPOSED

  • The time condition component MUST support an additional filter(s) to control date ranges
  • Date ranges MUST support the most common calendar used by most of the world (https://en.wikipedia.org/wiki/Gregorian_calendar)
  • This date-range MUST be an OPTIONAL filter (if unspecified, MUST NOT impact any of the existing time or weekday functionality)
  • Optional filters to time ( weekday , date_... ) MUST be COMBINATION_AND logic (not OR)
  • The configurations for date ranges MUST be two separate configuration entities (i.e. date_start and date_end )
  • Date ranges MUST be inclusive to the dates specified
  • SHALL support standard ISO formatting YYYY-MM-DD
  • MUST support ranges across months and year boundaries
  • MUST handle leap days/years (and any typical scenarios where dates can come and go)
  • MUST support via configuration.yml as well as GUI automation builder (NOTE: weekday is not currently in the UI)

References

As workarounds, I found:

Make sure you vote for your own request…

1 Like

Would be extremely useful to people like me with a utility that issues only a handful of peak shaving events on a daily basis per year.