mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-14 21:06:28 +00:00
Update 2024-11-08-number_selector.md
This commit is contained in:
parent
9fda1b71a8
commit
0796e9e441
@ -12,31 +12,23 @@ Set this parameter in [config flows](/docs/data_entry_flow_index#show-form) to e
|
|||||||
New implementation (using an integer step):
|
New implementation (using an integer step):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
vol.Schema(
|
vol.Optional(CONF_ADDRESS): NumberSelector(
|
||||||
{
|
|
||||||
vol.Optional(CONF_ADDRESS): NumberSelector(
|
|
||||||
NumberSelectorConfig(
|
NumberSelectorConfig(
|
||||||
min=1, max=255, mode=NumberSelectorMode.BOX, step=1
|
min=1, max=255, mode=NumberSelectorMode.BOX, step=1
|
||||||
)
|
)
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Previous implementation (with explicit integer conversion):
|
Previous implementation (with explicit integer conversion):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
vol.Schema(
|
vol.Optional(CONF_ADDRESS): vol.All(
|
||||||
{
|
|
||||||
vol.Optional(CONF_ADDRESS): vol.All(
|
|
||||||
NumberSelector(
|
NumberSelector(
|
||||||
NumberSelectorConfig(
|
NumberSelectorConfig(
|
||||||
min=1, max=255, mode=NumberSelectorMode.BOX
|
min=1, max=255, mode=NumberSelectorMode.BOX
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
vol.Coerce(int),
|
vol.Coerce(int),
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user