
* 🔥 Removes octopress.js * 🔥 Removes use of root_url var * 🔥 Removes Octopress generator reference from feed * 🔥 Removes delicious support * 🔥 Removes support for Pinboard * 🔥 Removes support for Disqus * 🔥 Removes support for Google Plus * ↩️ Migrate custom after_footer to default template * ↩️ Migrate custom footer to default template * ↩️ Migrate custom header to default template * 🔥 Removes unused template files * 🚀 Places time to read directly in post template * 🚀 Removes unneeded capture from archive_post.html template * 🔥 🚀 Removes unused, but heaving sorting call in component page * 🚀 Merged javascripts into a single file * 🔥 Removes more uses of root_url * 🚀 Removal of unneeded captures from head * 🔥 🚀 Removal of expensive liquid HTML compressor * 🔥 Removes unneeded templates * 🚀 Replaces kramdown with GitHub's CommonMark 🚀 * 💄 Adds Prism code syntax highlighting * ✨ Adds support for redirect in Netlify * ↩️ 🔥 Let Netlify handle all developer doc redirects * ✏️ Fixes typo in redirects file: Netify -> Netlify * 🔥 Removes unused .themes folder * 🔥 Removes unused aside.html template * 🔥 Removes Disqus config leftover * 🔥 Removes rouge highlighter config * 🔥 Removes Octopress 🎉 * 💄 Adjust code block font size and adds soft wraps * 💄 Adds styling for inline code blocks * 💄 Improve styling of note/warning/info boxes + div support * 🔨 Rewrites all note/warning/info boxes
6.2 KiB
title | description | logo | ha_category | ha_release | redirect_from | ha_qa_scale | |
---|---|---|---|---|---|---|---|
Input Number | Instructions on how to integrate the Input Number integration into Home Assistant. | home-assistant.png |
|
0.55 | /components/input_slider/ | internal |
Before version 0.55 this integration was known as input_slider
and did not have the mode
configuration option. Also, service select_value
is now set_value
.
The input_number
integration 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.
To enable this input number in your installation, add the following lines to your configuration.yaml
:
# Example configuration.yaml entry
input_number:
slider1:
name: Slider
initial: 30
min: -20
max: 35
step: 1
box1:
name: Numeric Input Box
initial: 30
min: -20
max: 35
step: 1
mode: box
{% configuration %}
input_number:
description: Alias for the input. Multiple entries are allowed.
required: true
type: map
keys:
min:
description: Minimum value.
required: true
type: float
max:
description: Maximum value.
required: true
type: float
name:
description: Friendly name of the input.
required: false
type: string
initial:
description: Initial value when Home Assistant starts.
required: false
type: float
default: 0
step:
description: Step value for the slider. Smallest value 0.001
.
required: false
type: float
default: 1
mode:
description: Can specify box
or slider
.
required: false
type: box | slider
default: slider
unit_of_measurement:
description: Unit of measurement in which the value of the slider is expressed in.
required: false
type: string
icon:
description: Icon to display in front of the box/slider in the frontend.
required: false
type: icon
{% endconfiguration %}
Restore State
This integration will automatically restore the state it had prior to Home Assistant stopping as long as your entity does not have a set value for initial
. To disable this feature, set a valid value for initial
.
Automation Examples
Here's an example of input_number
being used as a trigger in an automation.
{% raw %}
# Example configuration.yaml entry using 'input_number' as a trigger in an automation
input_number:
bedroom_brightness:
name: Brightness
initial: 254
min: 0
max: 254
step: 1
automation:
- alias: Bedroom Light - Adjust Brightness
trigger:
platform: state
entity_id: input_number.bedroom_brightness
action:
- service: light.turn_on
# Note the use of 'data_template:' below rather than the normal 'data:' if you weren't using an input variable
data_template:
entity_id: light.bedroom
brightness: "{{ trigger.to_state.state | int }}"
{% endraw %}
Another code example using input_number
, this time being used in an action in an automation.
{% raw %}
# Example configuration.yaml entry using 'input_number' in an action in an automation
input_select:
scene_bedroom:
name: Scene
options:
- Select
- Concentrate
- Energize
- Reading
- Relax
- 'OFF'
initial: 'Select'
input_number:
bedroom_brightness:
name: Brightness
initial: 254
min: 0
max: 254
step: 1
automation:
- alias: Bedroom Light - Custom
trigger:
platform: state
entity_id: input_select.scene_bedroom
to: CUSTOM
action:
- service: light.turn_on
# Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable.
data_template:
entity_id: light.bedroom
brightness: "{{ states('input_number.bedroom_brightness') | int }}"
{% endraw %}
Example of input_number
being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.
{% raw %}
# Example configuration.yaml entry using 'input_number' in an action in an automation
input_number:
target_temp:
name: Target Heater Temperature Slider
min: 1
max: 30
step: 1
unit_of_measurement: step
icon: mdi:target
# This automation script runs when a value is received via MQTT on retained topic: setTemperature
# It sets the value slider on the GUI. This slides also had its own automation when the value is changed.
automation:
- alias: Set temp slider
trigger:
platform: mqtt
topic: 'setTemperature'
action:
service: input_number.set_value
data_template:
entity_id: input_number.target_temp
value: "{{ trigger.payload }}"
# This second automation script runs when the target temperature slider is moved.
# It publishes its value to the same MQTT topic it is also subscribed to.
- alias: Temp slider moved
trigger:
platform: state
entity_id: input_number.target_temp
action:
service: mqtt.publish
data_template:
topic: 'setTemperature'
retain: true
payload: "{{ states('input_number.target_temp') | int }}"
{% endraw %}
Here's an example of input_number
being used as a delay in an automation.
{% raw %}
# Example configuration.yaml entry using 'input_number' as a delay in an automation
input_number:
minutes:
name: minutes
icon: mdi:clock-start
initial: 3
min: 0
max: 6
step: 1
seconds:
name: seconds
icon: mdi:clock-start
initial: 30
min: 0
max: 60
step: 10
automation:
- alias: turn something off after x time after turning it on
trigger:
platform: state
entity_id: switch.something
to: 'on'
action:
- delay: '00:{{ states('input_number.minutes') | int }}:{{ states('input_number.seconds') | int }}'
- service: switch.turn_off
entity_id: switch.something
{% endraw %}