You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/_components/input_number.markdown
+38-30Lines changed: 38 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
2
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
6
6
sidebar: true
7
7
comments: false
8
8
sharing: true
@@ -12,40 +12,48 @@ ha_category: Automation
12
12
ha_release: 0.16
13
13
---
14
14
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.
16
16
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`:
18
18
19
19
```yaml
20
20
# Example configuration.yaml entry
21
-
input_slider:
21
+
input_number:
22
22
slider1:
23
-
name: Slider 1
23
+
name: Slider
24
24
initial: 30
25
25
min: -20
26
26
max: 35
27
27
step: 1
28
+
box1:
29
+
name: Numeric Input Box
30
+
initial: 30
31
+
min: -20
32
+
max: 35
33
+
step: 1
34
+
mode: box
28
35
```
29
36
30
37
Configuration variables:
31
38
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.
36
43
- **initial** (*Optional*): Initial value when Home Assistant starts. Defaults to 0.
37
44
- **step** (*Optional*): Step value for the slider. Defaults to 1.
45
+
- **mode** (*Optional*): Can specify `box`, or `slider`. Defaults to `slider`.
38
46
39
47
## {% linkable_title Automation Examples %}
40
48
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.
42
50
43
51
```yaml
44
52
{% 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
46
54
47
-
# Define input_slider
48
-
input_slider:
55
+
# Define input_number
56
+
input_number:
49
57
bedroom_brightness:
50
58
name: Brightness
51
59
initial: 254
@@ -58,7 +66,7 @@ automation:
58
66
- alias: Bedroom Light - Adjust Brightness
59
67
trigger:
60
68
platform: state
61
-
entity_id: input_slider.bedroom_brightness
69
+
entity_id: input_number.bedroom_brightness
62
70
action:
63
71
- service: light.turn_on
64
72
# 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:
68
76
{% endraw %}
69
77
```
70
78
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.
72
80
73
81
```yaml
74
82
{% 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
76
84
77
85
# Define 'input_select'
78
86
input_select:
@@ -87,8 +95,8 @@ input_select:
87
95
- 'OFF'
88
96
initial: 'Select'
89
97
90
-
# Define input_slider
91
-
input_slider:
98
+
# Define input_number
99
+
input_number:
92
100
bedroom_brightness:
93
101
name: Brightness
94
102
initial: 254
@@ -108,19 +116,19 @@ automation:
108
116
# Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable.
109
117
data_template:
110
118
entity_id: light.bedroom
111
-
brightness: '{{ states.input_slider.bedroom_brightness.state | int }}'
119
+
brightness: '{{ states.input_number.bedroom_brightness.state | int }}'
112
120
{% endraw %}
113
121
```
114
122
115
123
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.
117
125
118
126
```yaml
119
127
{% 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
121
129
122
-
# Define input_slider
123
-
input_slider:
130
+
# Define input_number
131
+
input_number:
124
132
target_temp:
125
133
name: Target Heater Temperature Slider
126
134
min: 1
@@ -136,24 +144,24 @@ input_slider:
136
144
trigger:
137
145
platform: mqtt
138
146
topic: "setTemperature"
139
-
# entity_id: input_slider.target_temp
147
+
# entity_id: input_number.target_temp
140
148
action:
141
-
service: input_slider.select_value
149
+
service: input_number.set_value
142
150
data_template:
143
-
entity_id: input_slider.target_temp
151
+
entity_id: input_number.target_temp
144
152
value: '{{ trigger.payload}}'
145
153
146
154
# This automation script runs when the target temperature slider is moved.
147
155
# It publishes its value to the same MQTT topic it is also subscribed to.
148
156
- alias: Temp slider moved
149
157
trigger:
150
158
platform: state
151
-
entity_id: input_slider.target_temp
159
+
entity_id: input_number.target_temp
152
160
action:
153
161
service: mqtt.publish
154
162
data_template:
155
163
topic: "setTemperature"
156
164
retain: true
157
-
payload: '{{ states.input_slider.target_temp.state | int }}'
165
+
payload: '{{ states.input_number.target_temp.state | int }}'
Copy file name to clipboardExpand all lines: source/_cookbook/dim_and_brighten_lights.markdown
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -78,10 +78,10 @@ automation:
78
78
79
79
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.
80
80
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).
82
82
83
83
```yaml
84
-
input_slider:
84
+
input_number:
85
85
light_step:
86
86
name: 'Step the lights this much'
87
87
initial: 20
@@ -116,10 +116,10 @@ script:
116
116
entity_id: light.YOUR_LIGHT
117
117
brightness: >-
118
118
{% 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 %}
120
120
{% 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 %}
123
123
{% endif %}
124
124
{{ next }}{% endraw %}
125
125
@@ -142,10 +142,10 @@ script:
142
142
entity_id: light.YOUR_LIGHT
143
143
brightness: >-
144
144
{% 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 %}
146
146
{% 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 %}
0 commit comments