Skip to content

Commit decb5d2

Browse files
authored
Merge pull request home-assistant#3403 from BioSehnsucht/rename-input-slider
Rename input_slider to input_number and add numeric text box option
2 parents f598598 + 461ce5d commit decb5d2

File tree

7 files changed

+59
-51
lines changed

7 files changed

+59
-51
lines changed

source/_components/dweet.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To use the `dweet` component in your installation, add the following to your `co
3131
dweet:
3232
name: HAExport
3333
whitelist:
34-
- input_slider.brightness
34+
- input_number.brightness
3535
- input_boolean.notify_home
3636
- sensor.weather_temperature
3737
- sensor.cpu

source/_components/input_slider.markdown renamed to source/_components/input_number.markdown

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
layout: page
3-
title: "Input Slider"
4-
description: "Instructions how to integrate the Input Slider component into Home Assistant."
5-
date: 2016-03-15 06:00
3+
title: "Input Number"
4+
description: "Instructions how to integrate the Input Number component into Home Assistant."
5+
date: 2017-09-19 03:30
66
sidebar: true
77
comments: false
88
sharing: true
@@ -12,40 +12,48 @@ ha_category: Automation
1212
ha_release: 0.16
1313
---
1414

15-
The `input_slider` component allows the user to define values that can be controlled via the frontend and can be used within conditions of automation. Changes to the slider generate state events. These state events can be utilized as `automation` triggers as well.
15+
The `input_number` component allows the user to define values that can be controlled via the frontend and can be used within conditions of automation. The frontend can display a slider, or a numeric input box. Changes to the slider or numeric input box generate state events. These state events can be utilized as `automation` triggers as well.
1616

17-
To enable this input sliders in your installation, add the following lines to your `configuration.yaml`:
17+
To enable this input number in your installation, add the following lines to your `configuration.yaml`:
1818

1919
```yaml
2020
# Example configuration.yaml entry
21-
input_slider:
21+
input_number:
2222
slider1:
23-
name: Slider 1
23+
name: Slider
2424
initial: 30
2525
min: -20
2626
max: 35
2727
step: 1
28+
box1:
29+
name: Numeric Input Box
30+
initial: 30
31+
min: -20
32+
max: 35
33+
step: 1
34+
mode: box
2835
```
2936
3037
Configuration variables:
3138
32-
- **[alias]** (*Required*): Alias for the slider input. Multiple entries are allowed.
33-
- **min** (*Required*): Minimum value for the slider.
34-
- **max** (*Required*): Maximum value for the slider.
35-
- **name** (*Optional*): Friendly name of the slider input.
39+
- **[alias]** (*Required*): Alias for the input. Multiple entries are allowed.
40+
- **min** (*Required*): Minimum value.
41+
- **max** (*Required*): Maximum value.
42+
- **name** (*Optional*): Friendly name of the input.
3643
- **initial** (*Optional*): Initial value when Home Assistant starts. Defaults to 0.
3744
- **step** (*Optional*): Step value for the slider. Defaults to 1.
45+
- **mode** (*Optional*): Can specify `box`, or `slider`. Defaults to `slider`.
3846

3947
## {% linkable_title Automation Examples %}
4048

41-
Here's an example of `input_slider` being used as a trigger in an automation.
49+
Here's an example of `input_number` being used as a trigger in an automation.
4250

4351
```yaml
4452
{% raw %}
45-
# Example configuration.yaml entry using 'input_slider' as a trigger in an automation
53+
# Example configuration.yaml entry using 'input_number' as a trigger in an automation
4654
47-
# Define input_slider
48-
input_slider:
55+
# Define input_number
56+
input_number:
4957
bedroom_brightness:
5058
name: Brightness
5159
initial: 254
@@ -58,7 +66,7 @@ automation:
5866
- alias: Bedroom Light - Adjust Brightness
5967
trigger:
6068
platform: state
61-
entity_id: input_slider.bedroom_brightness
69+
entity_id: input_number.bedroom_brightness
6270
action:
6371
- service: light.turn_on
6472
# Note the use of 'data_template:' below rather than the normal 'data:' if you weren't using an input variable
@@ -68,11 +76,11 @@ automation:
6876
{% endraw %}
6977
```
7078

71-
Another code example using `input_slider`, this time being used in an action in an automation.
79+
Another code example using `input_number`, this time being used in an action in an automation.
7280

7381
```yaml
7482
{% raw %}
75-
# Example configuration.yaml entry using 'input_slider' in an action in an automation
83+
# Example configuration.yaml entry using 'input_number' in an action in an automation
7684
7785
# Define 'input_select'
7886
input_select:
@@ -87,8 +95,8 @@ input_select:
8795
- 'OFF'
8896
initial: 'Select'
8997
90-
# Define input_slider
91-
input_slider:
98+
# Define input_number
99+
input_number:
92100
bedroom_brightness:
93101
name: Brightness
94102
initial: 254
@@ -108,19 +116,19 @@ automation:
108116
# Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable.
109117
data_template:
110118
entity_id: light.bedroom
111-
brightness: '{{ states.input_slider.bedroom_brightness.state | int }}'
119+
brightness: '{{ states.input_number.bedroom_brightness.state | int }}'
112120
{% endraw %}
113121
```
114122

115123

116-
Example of `input_slider` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.
124+
Example of `input_number` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.
117125

118126
```yaml
119127
{% raw %}
120-
# Example configuration.yaml entry using 'input_slider' in an action in an automation
128+
# Example configuration.yaml entry using 'input_number' in an action in an automation
121129
122-
# Define input_slider
123-
input_slider:
130+
# Define input_number
131+
input_number:
124132
target_temp:
125133
name: Target Heater Temperature Slider
126134
min: 1
@@ -136,24 +144,24 @@ input_slider:
136144
trigger:
137145
platform: mqtt
138146
topic: "setTemperature"
139-
# entity_id: input_slider.target_temp
147+
# entity_id: input_number.target_temp
140148
action:
141-
service: input_slider.select_value
149+
service: input_number.set_value
142150
data_template:
143-
entity_id: input_slider.target_temp
151+
entity_id: input_number.target_temp
144152
value: '{{ trigger.payload}}'
145153
146154
# This automation script runs when the target temperature slider is moved.
147155
# It publishes its value to the same MQTT topic it is also subscribed to.
148156
- alias: Temp slider moved
149157
trigger:
150158
platform: state
151-
entity_id: input_slider.target_temp
159+
entity_id: input_number.target_temp
152160
action:
153161
service: mqtt.publish
154162
data_template:
155163
topic: "setTemperature"
156164
retain: true
157-
payload: '{{ states.input_slider.target_temp.state | int }}'
165+
payload: '{{ states.input_number.target_temp.state | int }}'
158166
{% endraw %}
159167
```

source/_components/shell_command.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ automation:
3939
- alias: run_set_ac
4040
trigger:
4141
platform: state
42-
entity_id: input_slider.ac_temperature
42+
entity_id: input_number.ac_temperature
4343
action:
4444
service: shell_command.set_ac_to_slider
4545
46-
input_slider:
46+
input_number:
4747
ac_temperature:
4848
name: A/C Setting
4949
initial: 24
@@ -53,6 +53,6 @@ input_slider:
5353
5454
{% raw %}
5555
shell_command:
56-
set_ac_to_slider: 'irsend SEND_ONCE DELONGHI AC_{{ states.input_slider.ac_temperature.state }}_AUTO'
56+
set_ac_to_slider: 'irsend SEND_ONCE DELONGHI AC_{{ states.input_number.ac_temperature.state }}_AUTO'
5757
{% endraw %}
5858
```

source/_cookbook/dim_and_brighten_lights.markdown

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ automation:
7878
7979
There are 2 variables that control the speed of the change for the scripts below. The first is the `step`, small steps create a smooth transition. The second is the delay, larger delays will create a slower transition.
8080

81-
To allow flexibility, an [Input Slider](/components/input_slider/) is used for the step (at the time of writing this, it's not possible to template the delay when the delay uses milliseconds). Two additional [Input Sliders](/components/input_slider/) are used to set the minimum and maximum brightness, so that it's easy to tune that (or manage it through an automation).
81+
To allow flexibility, an [Input Number](/components/input_number/) is used for the step (at the time of writing this, it's not possible to template the delay when the delay uses milliseconds). Two additional [Input Numbers](/components/input_number/) are used to set the minimum and maximum brightness, so that it's easy to tune that (or manage it through an automation).
8282

8383
```yaml
84-
input_slider:
84+
input_number:
8585
light_step:
8686
name: 'Step the lights this much'
8787
initial: 20
@@ -116,10 +116,10 @@ script:
116116
entity_id: light.YOUR_LIGHT
117117
brightness: >-
118118
{% raw %}{% set current = states.light.YOUR_LIGHT.attributes.brightness|default(0)|int %}
119-
{% set step = states('input_slider.light_step')|int %}
119+
{% set step = states('input_number.light_step')|int %}
120120
{% set next = current + step %}
121-
{% if next > states('input_slider.light_maximum')|int %}
122-
{% set next = states('input_slider.light_maximum')|int %}
121+
{% if next > states('input_number.light_maximum')|int %}
122+
{% set next = states('input_number.light_maximum')|int %}
123123
{% endif %}
124124
{{ next }}{% endraw %}
125125
@@ -142,10 +142,10 @@ script:
142142
entity_id: light.YOUR_LIGHT
143143
brightness: >-
144144
{% raw %}{% set current = states.light.YOUR_LIGHT.attributes.brightness|default(0)|int %}
145-
{% set step = states('input_slider.light_step')|int %}
145+
{% set step = states('input_number.light_step')|int %}
146146
{% set next = current - step %}
147-
{% if next < states('input_slider.light_minimum')|int %}
148-
{% set next = states('input_slider.light_minimum')|int %}
147+
{% if next < states('input_number.light_minimum')|int %}
148+
{% set next = states('input_number.light_minimum')|int %}
149149
{% endif %}
150150
{{ next }}{% endraw %}
151151

source/_docs/ecosystem/appdaemon/api.markdown

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ self.toggle("light.office_1", color_name = "green")
12571257

12581258
### {% linkable_title select_value() %}
12591259

1260-
This is a convenience function for the `input_slider.select_value` function. It is able to set the value of an input_slider in Home Assistant.
1260+
This is a convenience function for the `input_number.select_value` function. It is able to set the value of an input_number in Home Assistant.
12611261

12621262
#### {% linkable_title Synopsis %}
12631263

@@ -1273,16 +1273,16 @@ None
12731273

12741274
##### {% linkable_title entity_id %}
12751275

1276-
Fully qualified entity_id of the input_slider to be changed, e.g. `input_slider.alarm_hour`.
1276+
Fully qualified entity_id of the input_number to be changed, e.g. `input_number.alarm_hour`.
12771277

12781278
##### {% linkable_title value %}
12791279

1280-
The new value to set the input slider to.
1280+
The new value to set the input number to.
12811281

12821282
#### {% linkable_title Examples %}
12831283

12841284
```python
1285-
self.select_value("input_slider.alarm_hour", 6)
1285+
self.select_value("input_number.alarm_hour", 6)
12861286
```
12871287

12881288
### {% linkable_title select_option() %}
@@ -1307,7 +1307,7 @@ Fully qualified entity_id of the input_select to be changed, e.g. `input_select.
13071307

13081308
##### {% linkable_title value %}
13091309

1310-
The new value to set the input slider to.
1310+
The new value to set the input number to.
13111311

13121312
#### {% linkable_title Examples %}
13131313

source/_docs/scripts.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ delay:
7171
```
7272

7373
```yaml
74-
# Waits however many minutes input_slider.minute_delay is set to
74+
# Waits however many minutes input_number.minute_delay is set to
7575
# Valid formats include HH:MM and HH:MM:SS
76-
delay: {% raw %}'00:{{ states.input_slider.minute_delay.state | int }}:00'{% endraw %}
76+
delay: {% raw %}'00:{{ states.input_number.minute_delay.state | int }}:00'{% endraw %}
7777
```
7878
### {% linkable_title Wait %}
7979

source/demo/frontend.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)