Skip to content
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

Template lock new syntax #35243

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

tetele
Copy link
Contributor

@tetele tetele commented Oct 15, 2024

Proposed change

Template locks now support the new template entity syntax (which is also the default)

Type of change

  • 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).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

Checklist

  • 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.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • New Features

    • Updated documentation for Template Lock integration, introducing a new configuration structure for locks.
    • Expanded entity types in the template integration to include locks, with detailed configuration examples.
  • Documentation

    • Enhanced clarity and organization of the documentation with updated parameter names and structured examples for lock entities.

@tetele tetele requested a review from a team as a code owner October 15, 2024 10:41
@home-assistant home-assistant bot added Hacktoberfest An PR on this issue (or the PR itself) is eligible towards Hacktoberfest! has-parent This PR has a parent PR in a other repo next This PR goes into the next branch labels Oct 15, 2024
Copy link

netlify bot commented Oct 15, 2024

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit a302eb4
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/670e46ed7e68730008fab29a
😎 Deploy Preview https://deploy-preview-35243--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

coderabbitai bot commented Oct 15, 2024

📝 Walkthrough

Walkthrough

The changes involve updates to the documentation for the Template Lock integration and the Template integration in Home Assistant. The Template Lock documentation has restructured the YAML configuration format, requiring users to nest lock definitions under a new template key. Several configuration parameters have been renamed for clarity. The Template integration documentation has been expanded to include locks as a new entity type, with updated sections and examples reflecting the new configuration structure.

Changes

File Change Summary
source/_integrations/lock.template.markdown - Restructured configuration format from lock to template key.
- Renamed parameters: value_template to state, availability_template to availability, code_format_template to code_format.
- Added note about UI configuration not being available for template locks.
- Updated examples to reflect new structure.
source/_integrations/template.markdown - Added "locks" as a new entity type in documentation.
- Introduced new section for lock configuration with attributes: state, availability, code_format, lock, unlock, and optimistic.
- Updated descriptions and examples for clarity and consistency.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomeAssistant
    participant TemplateLock

    User->>HomeAssistant: Configure lock under template key
    HomeAssistant->>TemplateLock: Process configuration
    TemplateLock-->>HomeAssistant: Lock state, availability, and actions
    HomeAssistant-->>User: Confirmation of configuration
Loading

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (6)
source/_integrations/lock.template.markdown (4)

19-20: LGTM! Helpful additions and clear example of new syntax.

The changes in this section are well-structured and informative:

  1. The addition of the related document link for Template entities is helpful.
  2. The note about UI configuration not being available is crucial information for users.
  3. The updated configuration example clearly demonstrates the new syntax.

Consider adding a brief explanation of why UI configuration is not available for template locks, if possible. This could help users understand the limitation better.

Also applies to: 33-35, 43-54


60-97: Configuration section updates look good, but consider clarifying the 'state' parameter.

The changes in the configuration section accurately reflect the new structure and parameter names:

  1. The addition of unique_id is helpful for UI customization.
  2. The renaming of parameters (e.g., value_template to state) is consistent with the reported changes.
  3. The new availability parameter provides useful functionality.

Consider adding a note or example for the state parameter to clarify that it replaces the former value_template. This could help users who are familiar with the old syntax understand the change better.

🧰 Tools
🪛 LanguageTool

[misspelling] ~75-~75: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. re...

(EN_COMPOUNDS_CASE_SENSITIVE)


Line range hint 119-204: Examples section is comprehensive and well-updated.

The examples section has been thoroughly updated and improved:

  1. All examples now use the new syntax, providing clear guidance for users.
  2. The range of examples (basic lock, optimistic mode, sensor with two switches) covers various use cases.
  3. The new example with dynamic code is an excellent addition, demonstrating an advanced scenario.

Consider adding a brief comment before each example to explain its specific use case or the concept it's demonstrating. This could help users quickly identify the most relevant example for their needs.


Line range hint 1-204: Overall, excellent update to the Template Lock documentation.

The document has been successfully updated to reflect the new template lock syntax:

  1. The structure is logical and easy to follow.
  2. All changes are consistent with the reported modifications.
  3. The language is clear and appropriate for the target audience.
  4. The examples are comprehensive and demonstrate various use cases.

Consider adding a "Breaking Changes" or "Migration Guide" section at the beginning of the document. This would help existing users understand how to update their configurations from the old syntax to the new one.

🧰 Tools
🪛 LanguageTool

[misspelling] ~75-~75: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. re...

(EN_COMPOUNDS_CASE_SENSITIVE)

source/_integrations/template.markdown (2)

305-338: Consider adding a brief example for lock configuration

To maintain consistency with other entity types in the documentation, consider adding a brief YAML example for the lock configuration. This would help users understand how to implement a template lock in their configuration. Here's a suggested example:

template:
  - lock:
      - name: "Template Lock"
        state: "{{ states('input_select.lock_status') }}"
        lock:
          service: script.lock_door
        unlock:
          service: script.unlock_door

Adding this example would align the lock documentation with other entity types and provide users with a quick reference for implementation.

🧰 Tools
🪛 LanguageTool

[misspelling] ~316-~316: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. ...

(EN_COMPOUNDS_CASE_SENSITIVE)


Line range hint 1-24: Update introduction to include locks

To ensure completeness and clarity, consider updating the introduction paragraph to explicitly mention locks as a supported entity type. This change would immediately inform users about the full range of entities supported by the Template integration.

Suggested update for the second paragraph:

Sensors, binary (on/off) sensors, buttons, images, locks, numbers, and selects are covered on this page. They can be configured using [UI](#configuration) or [YAML](#yaml-configuration) file.

This minor change would help users quickly understand that locks are now supported by the Template integration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8a9f78b and a302eb4.

📒 Files selected for processing (2)
  • source/_integrations/lock.template.markdown (6 hunks)
  • source/_integrations/template.markdown (3 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/lock.template.markdown

[misspelling] ~75-~75: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. re...

(EN_COMPOUNDS_CASE_SENSITIVE)

source/_integrations/template.markdown

[misspelling] ~316-~316: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. ...

(EN_COMPOUNDS_CASE_SENSITIVE)

🔇 Additional comments (3)
source/_integrations/lock.template.markdown (1)

Line range hint 99-101: Excellent addition of Template and action variables section.

The new section on Template and action variables is a valuable addition to the documentation:

  1. It introduces the this variable, which is crucial for working with templates.
  2. The explanation is concise and provides a link to more detailed documentation on self-referencing.

This information will be very helpful for users creating complex template locks.

🧰 Tools
🪛 LanguageTool

[misspelling] ~75-~75: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. re...

(EN_COMPOUNDS_CASE_SENSITIVE)

source/_integrations/template.markdown (2)

305-338: LGTM: Lock configuration added successfully

The new lock configuration has been added to the Template integration documentation. The structure and content are consistent with other entity types in the document. Here's a summary of the changes:

  1. Lock entity type added to the configuration options.
  2. Proper indentation and formatting maintained.
  3. All required and optional fields for lock entities are documented.
  4. Descriptions for each field are clear and informative.

The addition of lock entities enhances the capabilities of the Template integration, providing users with more flexibility in their Home Assistant setups.

🧰 Tools
🪛 LanguageTool

[misspelling] ~316-~316: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. ...

(EN_COMPOUNDS_CASE_SENSITIVE)


Line range hint 1-424: Overall: Excellent addition of lock support to Template integration

The changes to add lock support to the Template integration documentation are well-implemented and maintain the high quality of the existing documentation. The new lock configuration section is clear, consistent, and provides users with the necessary information to implement template locks in their Home Assistant setups.

A few minor suggestions have been made to further enhance the documentation:

  1. Adding a brief YAML example for lock configuration.
  2. Updating the introduction to explicitly mention locks as a supported entity type.

These suggestions are not critical but would improve the overall user experience and consistency of the documentation.

Great job on expanding the capabilities of the Template integration!

🧰 Tools
🪛 LanguageTool

[misspelling] ~316-~316: This word is normally spelled with a hyphen.
Context: ...e. Note that the string comparison not case sensitive; "TrUe"and"yEs"` are allowed. ...

(EN_COMPOUNDS_CASE_SENSITIVE)

@tetele tetele mentioned this pull request Oct 15, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest An PR on this issue (or the PR itself) is eligible towards Hacktoberfest! has-parent This PR has a parent PR in a other repo next This PR goes into the next branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant