States(input_number)

configuration.yaml

template: !include templates.yaml

input_number:
  test:
    name: Slider
    initial: 30
    min: -20
    max: 35
    step: 1

templates.yaml

- sensor:
  - name: Test sensor 1
    unique_id: test_sensor_1
    state: >
      {{ states.input_number.test.state | round(1, default=18) }}
  - name: Test sensor 2
    unique_id: test_sensor_2
    state: >
      {{ states(input_number.test) | round(1, default=18) }}

Why “Test sensor 1” is running and “Test sensor 2” not?

Because a variable input_number with item test does not exist.

states('input_number.test') would work.

1 Like