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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions source/_docs/blueprint/selectors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1085,10 +1085,17 @@ 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

description: Force the resulting number into an integer.
type: bool
epenet marked this conversation as resolved.
Show resolved Hide resolved
required: false
{% endconfiguration %}

The output of this selector is a number, for example: `42`

Please note that the user input is never rounded, regardless of the step,
and will always return a float unless `as_int` is set to `True`.

### Example number selectors <!-- omit from toc -->

An example number selector that allows a user a percentage, directly in a
Expand Down