-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Add date and datetime conditions #35234
base: next
Are you sure you want to change the base?
Conversation
<!-- 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
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
📝 WalkthroughWalkthroughThe documentation for script and automation conditions has been extensively revised. Key updates include the renaming of the "Time condition" section to "Time, date or datetime conditions," which now encompasses checks for date and datetime. New examples illustrate these functionalities, including the use of Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Automation
participant Conditions
User->>Automation: Trigger automation
Automation->>Conditions: Check conditions
alt Time condition
Conditions->>Conditions: Evaluate time
else Date condition
Conditions->>Conditions: Evaluate date
else Datetime condition
Conditions->>Conditions: Evaluate datetime
end
alt Trigger condition
Conditions->>Automation: Check trigger ID
end
alt Zone condition
Conditions->>Conditions: Evaluate zone for multiple entities
end
Automation-->>User: Automation result
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
source/_docs/scripts/conditions.markdown (4)
552-554
: LGTM: Clear example of datetime conditionThe added example effectively demonstrates the usage of the new datetime condition. The future date is appropriate for documentation.
Consider adding a brief comment explaining that this condition will be true after the specified date and time, to enhance clarity for users.
578-579
: LGTM: Good example of date condition with sensorThe updated example effectively demonstrates the use of the new date condition, showing how it can reference a sensor for dynamic date values.
Consider adding a brief explanation of what this condition does (e.g., "This condition will be true after the date provided by the shipping_delivery_date sensor") to provide more context for users.
Line range hint
590-638
: LGTM: Comprehensive explanation of new Trigger conditionThe new "Trigger condition" section is a valuable addition, providing clear explanations and examples for testing specific triggers in automations. This feature will enable more sophisticated automation control.
Consider adding a brief example or explanation of a practical use case for this condition (e.g., "This can be useful when you want different actions based on which trigger fired the automation") to help users understand when they might want to use this feature.
Line range hint
537-638
: Great additions to condition capabilitiesThe changes in this PR significantly enhance the condition system in Home Assistant by:
- Adding new date and datetime conditions.
- Introducing a trigger condition for more complex automations.
- Providing clear examples and explanations for each new feature.
These additions align well with the PR objectives and will provide users with more powerful and flexible automation options.
As these changes introduce new condition types, ensure that the core Home Assistant documentation (e.g., in the automation and script sections) is updated to reflect these new capabilities. This will help maintain consistency across the documentation and ensure users are aware of these new features in relevant contexts.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- source/_docs/scripts/conditions.markdown (3 hunks)
🧰 Additional context used
🔇 Additional comments (2)
source/_docs/scripts/conditions.markdown (2)
537-539
: LGTM: Expanded condition types accurately describedThe updated title and description effectively communicate the addition of date and datetime conditions, providing users with a clear overview of the expanded functionality.
586-587
: LGTM: Important clarification on condition behaviorsThe added note provides essential information about the scope of each condition type (time, date, and datetime). This clarification will help users choose the appropriate condition type for their needs and prevent potential misunderstandings.
Proposed change
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 looking for it, I noticed I was not the only one.
There is one ticket (#24317), but also forum discussions about it.
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit
New Features
datetime
, with examples for specific date and time checks.Documentation