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

Adjust step documentation for NumberSelector #35650

Open
wants to merge 7 commits into
base: next
Choose a base branch
from
Open

Conversation

epenet
Copy link
Contributor

@epenet epenet commented Nov 8, 2024

Proposed change

Linked to home-assistant/core#130104

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

    • Extensive updates to documentation for selectors in the blueprint system.
    • Introduction of new configuration options, including as_int for number selectors.
    • Enhanced selectors with detailed configuration options: enable_day, enable_millisecond, placeholder, no_sort, and native_name.
    • Comprehensive examples added for area, device, and entity selectors.
  • Documentation

    • Improved clarity and structure in selector documentation, including YAML examples for user guidance.

@home-assistant home-assistant bot added has-parent This PR has a parent PR in a other repo next This PR goes into the next branch labels Nov 8, 2024
Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit 17b534e
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/673314caf1599200084b5452
😎 Deploy Preview https://deploy-preview-35650--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 Nov 8, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces extensive updates to the documentation for selectors within the blueprint system. Key enhancements include the addition of new configuration options, such as as_int for the number selector and various attributes for other selectors like duration, icon, country, and language. The documentation now features detailed examples and clearer guidance on expected outputs, including YAML examples, improving user understanding of selector functionalities and their configurations.

Changes

File Path Change Summary
source/_docs/blueprint/selectors.markdown Updated documentation to include new configuration options: as_int (number selector), enable_day, enable_millisecond (duration selector), placeholder (icon selector), no_sort (country and language selectors), and native_name (language selector). Enhanced examples and guidance for selectors like area, device, and entity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Selector
    participant Documentation

    User->>Selector: Request selector configuration
    Selector->>Documentation: Retrieve updated options
    Documentation-->>Selector: Provide new options (e.g., as_int, enable_day)
    Selector-->>User: Present configuration options and examples
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 (1)
source/_docs/blueprint/selectors.markdown (1)

1096-1098: Consider adding a usage example for the as_int option.

While the behavior note is clear and helpful, consider adding a code example to demonstrate the as_int usage. This would help users better understand how to implement integer-only number selectors.

# Example number selector forcing integer output
number:
  min: 0
  max: 100
  as_int: true
  unit_of_measurement: "items"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between cd18fda and 7364b16.

📒 Files selected for processing (1)
  • source/_docs/blueprint/selectors.markdown (1 hunks)
🔇 Additional comments (1)
source/_docs/blueprint/selectors.markdown (1)

1088-1091: LGTM! Clear and well-structured configuration documentation.

The new as_int configuration option is well documented with clear description, type, and optional status.

@@ -1085,10 +1085,18 @@ mode:
type: string
required: false
default: slider
as_int:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would I want this to be an integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For blueprints... I'm not sure.
The issue originates from config flows, that cannot use the selector easily for a port and the NumberSelector currently always returns a float.

The core code is doted with vol.Coerce(int) or int(user_input[CONF_PORT]) to ensure that the float is converted to an integer.

See home-assistant/core#130084 and home-assistant/core#130104

@epenet epenet changed the title Document as_int in NumberSelector Adjust step documentation for NumberSelector Nov 12, 2024
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 (1)
source/_docs/blueprint/selectors.markdown (1)

1092-1094: Fix grammar and formatting issues in the step behavior notes

The added notes about step behavior are helpful but contain some formatting and grammar issues.

Apply these corrections:

-Please note that:
-- if the step is a `float` (eg. `step=0.1` or `step=1.0`) the user input is never rounded.
-- if the step is an `integer` (eg. `step=1`) passing a number with decimal precision will be rejected (eg. `80.0` will converted to `80` and `80.1` will be rejected).
+Please note that:
+
+- if the step is a `float` (e.g., `step=0.1` or `step=1.0`) the user input is never rounded.
+- if the step is an `integer` (e.g., `step=1`) passing a number with decimal precision will be rejected (e.g., `80.0` will be converted to `80` and `80.1` will be rejected).

Changes made:

  1. Added blank line after the list introduction
  2. Fixed "e.g." abbreviations to include periods
  3. Fixed grammar: "will converted" → "will be converted"
  4. Added commas after "e.g." for better readability
🧰 Tools
🪛 LanguageTool

[uncategorized] ~1093-~1093: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... note that: - if the step is a float (eg. step=0.1 or step=1.0) the user inpu...

(E_G)


[uncategorized] ~1094-~1094: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...rounded. - if the step is an integer (eg. step=1) passing a number with decimal...

(E_G)


[uncategorized] ~1094-~1094: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...ith decimal precision will be rejected (eg. 80.0 will converted to 80 and `80.1...

(E_G)


[grammar] ~1094-~1094: The modal verb ‘will’ requires the verb’s base form.
Context: ...ision will be rejected (eg. 80.0 will converted to 80 and 80.1 will be rejected). ...

(MD_BASEFORM)

🪛 Markdownlint

1093-1093: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 588d8bd and 17b534e.

📒 Files selected for processing (1)
  • source/_docs/blueprint/selectors.markdown (1 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_docs/blueprint/selectors.markdown

[uncategorized] ~1093-~1093: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... note that: - if the step is a float (eg. step=0.1 or step=1.0) the user inpu...

(E_G)


[uncategorized] ~1094-~1094: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...rounded. - if the step is an integer (eg. step=1) passing a number with decimal...

(E_G)


[uncategorized] ~1094-~1094: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...ith decimal precision will be rejected (eg. 80.0 will converted to 80 and `80.1...

(E_G)


[grammar] ~1094-~1094: The modal verb ‘will’ requires the verb’s base form.
Context: ...ision will be rejected (eg. 80.0 will converted to 80 and 80.1 will be rejected). ...

(MD_BASEFORM)

🪛 Markdownlint
source/_docs/blueprint/selectors.markdown

1093-1093: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

🔇 Additional comments (1)
source/_docs/blueprint/selectors.markdown (1)

1090-1091: LGTM: Clear example of number selector output

The added example clearly demonstrates the expected output format for the number selector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants