Input Number (2024)

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.

The preferred way to configure an input number is via the user interface at Settings > Devices & Services > Helpers. Click the add button and then choose the Number option.

To be able to add Helpers via the user interface you should have default_config: in your configuration.yaml, it should already be there by default unless you removed it.If you removed default_config: from you configuration, you must add input_number: to your configuration.yaml first, then you can use the UI.

Input numbers can also be configured via configuration.yaml:

# Example configuration.yaml entryinput_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 Variables

input_number map Required

Alias for the input. Multiple entries are allowed.

max float Required

Maximum value.

name string (Optional)

Friendly name of the input.

initial float (Optional, default: The value at shutdown)

Initial value when Home Assistant starts.

step float (Optional, default: 1)

Step value. Smallest value 0.001.

See Also
Button card

mode string (Optional, default: slider)

Can specify box or slider.

unit_of_measurement string (Optional)

Unit of measurement in which the value of the slider is expressed in.

icon icon (Optional)

Icon to display in front of the input element in the frontend.

Services

This integration provides the following services to modify the state of the input_number and a service to reload theconfiguration without restarting Home Assistant itself.

ServiceDataDescription
decremententity_id(s)
area_id(s)
Decrement the value of specific input_number entities by step
incremententity_id(s)
area_id(s)
Increment the value of specific input_number entities by step
reloadReload input_number configuration
set_valuevalue
entity_id(s)
area_id(s)
Set the value of specific input_number entities

Restore state

If you set a valid value for initial this integration will start with the state set to that value. Otherwise, it will restore the state it had prior to Home Assistant stopping. Please note that initial is only available in a YAML configuration and not via the Home Assistant user interface.

Scenes

To set the value of an input_number in a Scene:

# Example configuration.yaml entryscene: - name: Example Scene entities: input_number.example_number: 13

Automation examples

Here’s an example of input_number being used as a trigger in an automation.

# Example configuration.yaml entry using 'input_number' as a trigger in an automationinput_number: bedroom_brightness: name: Brightness initial: 254 min: 0 max: 254 step: 1automation: - alias: "Bedroom Light - Adjust Brightness" trigger: platform: state entity_id: input_number.bedroom_brightness action: - service: light.turn_on target: entity_id: light.bedroom data: brightness: "{{ trigger.to_state.state | int }}"

Another code example using input_number, this time being used in an action in an automation.

# Example configuration.yaml entry using 'input_number' in an action in an automationinput_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: 1automation: - alias: "Bedroom Light - Custom" trigger: platform: state entity_id: input_select.scene_bedroom to: CUSTOM action: - service: light.turn_on target: entity_id: light.bedroom data: brightness: "{{ states('input_number.bedroom_brightness') | int }}"

Example of input_number being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.

# Example configuration.yaml entry using 'input_number' in an action in an automationinput_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 target: entity_id: input_number.target_temp data: 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: topic: "setTemperature" retain: true payload: "{{ states('input_number.target_temp') | int }}"

Here’s an example of input_number being used as a delay in an automation.

# Example configuration.yaml entry using 'input_number' as a delay in an automationinput_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: 59 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 target: entity_id: switch.something

Help us to improve our documentation

Suggest an edit to this page, or provide/view feedback for this page.

Input Number (2024)
Top Articles
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 6071

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.