Components Home Assistant "Input Number"

2 minutes of reading
Proconductor: Home Assistant Community
Availability: included in thepersonale HUB Home Assistant
Category: software
Type: components Home Assistant
Implementation difficulties: low

The "Input Number" component di Home Assistant it allows to create "sliders" that allow, through the frontend graphic interface, to acquire a variable number included in a defined interval.

Home Assistant - Input Number
a double example of a slider

This element it is convenient especially when defining automations: it is in fact useful to be able to insert variable values ​​based on the conditions of use.

Define a box or a slider by component "Input Number" it's very simple. An example of configuration in configuration.yaml is the following:

    name: FAN Max°
    initial: 29
    min: 27
    max: 31
    step: 0.1
    name: FAN Min°
    initial: 26
    min: 24
    max: 28
    step: 0.1


input_numberdefines the configuration block related to the box / slider (multiple can be defined)
name(string, optional) defines the name of the box / slider
min/max(decimal, mandatory) the values ​​that define the low and high apex of the slider interval
initial(decimal, optional) initial position of the box / slider
step(decimal, optional) resolution of the slider
mode(box | slider, optional) whether to display a box or a slider (default: slider)
unit_of_measurement(string, optional) the unit of measurement of the box / slider
icon(string, optional) the icon to associate

If the "Recorder" component is active, the boxes / sliders maintain, even after a restart of Home Assistant, the last registered numeric status, as long as the variable "initialno is valued.

Automation examples

The one to follow is an example of automation in which a input_number is used as trigger of an automation. Given the change in the value of theinput_number, the lights are turned on:

    name: Brightness
    initial: 254
    min: 0
    max: 254
    step: 1
  - alias: Regolazione luminosità stanza
      platform: state
      entity_id: input_number.luminosita_stanza
      - service: light.turn_on
          entity_id: light.bedroom
          brightness: "{{ trigger.to_state.state | int }}"

In this other example, two input_number (minutes and seconds) are used to adjust the automation start delay,

    name: minuti
    icon: mdi:clock-start
    initial: 3
    min: 0
    max: 6
    step: 1
    name: secondi
    icon: mdi:clock-start
    initial: 30
    min: 0
    max: 60
    step: 10
 - alias: Spegni qualcosa dopo X secondi dalla propria accensione
     platform: state
     entity_id: switch.something
     to: 'on'
     - delay: '00:{{ states.input_number.minutes.state | int }}:{{ states.input_number.seconds.state | int }}'
     - service: switch.turn_off
       entity_id: switch.something

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

inDomus telegram channel