Update 2024-11-08-number_selector.md

This commit is contained in:
epenet 2024-11-08 11:47:27 +01:00 committed by GitHub
parent e9bfd09545
commit 25dd21db0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,14 +1,14 @@
--- ---
author: epenet author: epenet
authorURL: https://github.com/epenet authorURL: https://github.com/epenet
title: "Return an integer in number selector" title: "Number selector adds integer return value support"
--- ---
The [Number selector](https://www.home-assistant.io/docs/blueprint/selectors/#number-selector) has been expanded and now also includes an `as_int` parameter. The [Number selector](https://www.home-assistant.io/docs/blueprint/selectors/#number-selector) now includes an `as_int` parameter.
Using this in [config flows](/docs/data_entry_flow_index#show-form) will remove the need to add an extra validation to the schema. Set this parameter in [config flows](/docs/data_entry_flow_index#show-form) to eliminate the extra schema validation step.
Example: New implementation:
```python ```python
vol.Schema( vol.Schema(
@ -22,7 +22,7 @@ vol.Schema(
) )
``` ```
Old code: Previous implementation (with explicit integer conversion):
```python ```python
vol.Schema( vol.Schema(