-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HA automation condition to support date ranges #24317
Comments
From an implementation perspective, I believe extension for https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/helpers/condition.py#L360 |
Implementation wise, we should probably re-use https://pypi.org/project/DateTimeRange/ It supports (of course) checking if a date/time is wtihin a given range via: So once we have the date_start and date_end constructs, that can be linked with the condition based on time.now(). |
"TAG": looking for input into my requirements and implementation considerations before proceeding :) |
Not sure if it is technically in scope but the current automation editor UI only allows for before and after times, it does not appear to even support any of the existing advanced weekday attributes etc. Hopefully if date ranges are added they are also supported in the UI. |
Yes you are correct. See my last requirement in the list which accounted for this.
Though if the UI itself does not have this as base elements, I probably wouldn't implement that as part of this scope ... (more than I'd like to chew). (haven't looked into this) |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Still looking to get this addressed. Specifically the part about the weekday selection being added to the UI. |
I am still interested in this as well.. I shy away from making weekend / weekday automatons currently because of the lack of UI support. |
Note that the "workday" component and as a condition works fine in the UI as a workaround. |
I notice this issue now for the first time, but this is a feature request, not a bug (as already mentioned in the OP "this is an enhancement". We use GitHub for tracking issues, not for providing support or tracking feature requests. If you want to suggest a feature, you should try our Community Forum: Feature Requests. If you have additional questions, feel free to join our Discord chat server. Thanks! 👍 |
<!-- You are amazing! Thanks for contributing to our project! Please, DO NOT DELETE ANY TEXT from this template! (unless instructed). Before submitting your pull request, please verify that you have chosen the correct target branch, and that the PR preview looks fine and does not include unrelated changes. --> ## Proposed change <!-- Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue in the additional information section. --> The goal is to be able to not only compare time, but also date and datetime. It's a missing feature that I need for my own setup, but as I was look for it, I noticed I was not the only one. There are some ticket (home-assistant#24317), but also [forum discussions](https://community.home-assistant.io/t/automation-during-date-range/133814) about it. ## Type of change <!-- What types of changes does your PR introduce to our documentation/website? Put an `x` in the boxes that apply. You can also fill these out after creating the PR. --> - [ ] Spelling, grammar or other readability improvements (`current` branch). - [ ] Adjusted missing or incorrect information in the current documentation (`current` branch). - [ ] Added documentation for a new integration I'm adding to Home Assistant (`next` branch). - [ ] I've opened up a PR to add logos and icons in [Brands repository](https://github.com/home-assistant/brands). - [x] Added documentation for a new feature I'm adding to Home Assistant (`next` branch). - [ ] Removed stale or deprecated documentation. ## Additional information <!-- Details are important, and help maintainers processing your PR. Please be sure to fill out additional details, if applicable. --> - Link to parent pull request in the codebase: home-assistant/core#128009 - Link to parent pull request in the Brands repository: - This PR fixes or closes issue: fixes home-assistant/core#24317 ## Checklist <!-- Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. --> - [x] This PR uses the correct branch, based on one of the following: - I made a change to the existing documentation and used the `current` branch. - I made a change that is related to an upcoming version of Home Assistant and used the `next` branch. - [x] The documentation follows the Home Assistant documentation [standards]. [standards]: https://developers.home-assistant.io/docs/documenting/standards
Home Assistant release with the issue:
0.92.2
Last working Home Assistant release (if known):
None (this is an enhancement)
Operating environment (Hass.io/Docker/Windows/etc.):
python3.6 virtual env
Component/platform:
https://www.home-assistant.io/docs/scripts/conditions/
Description of problem:
The conditions allow for sun level, time, etc; but no "date range".
https://www.home-assistant.io/docs/scripts/conditions/#time-condition
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 Repurposing
, 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):https://www.home-assistant.io/docs/scripts/conditions/#time-condition
, of note, it already has a subsequent
weekday
filter; so extension for date-range seems reasonableTraceback (if applicable):
N/A
Additional information:
Feature Suggestion / Idea
(open to implementing myself, would look for stakeholder agreement to the idea first)
Requirements
PROPOSED
time
condition component MUST support an additional filter(s) to control date rangestime
orweekday
functionality)weekday
,date_...
) MUST be COMBINATION_AND logic (not OR)date_start
anddate_end
)YYYY-MM-DD
configuration.yml
as well as GUI automation builder (NOTE:weekday
is not currently in the UI)The text was updated successfully, but these errors were encountered: