HA croaks about not existing number - which does exist

I have trouble using an input_number I created in automation. The number is is defined like so:

and my test-script like this:

alias: bla
description: ""
trigger: []
condition: []
action:
  - service: notify.persistent_notification
    metadata: {}
    data:
      message: "{{input_number.test}}"
  - service: number.set_value
    metadata: {}
    data:
      value: "123"
    target:
      entity_id: input_number.test
mode: single

What already made me wonder that there was no auto-completion on entering the entity:
Bildschirmfoto 2024-06-22 um 22.23.49

So when I run the script I get this trace log:

Executed: June 22, 2024 at 22:09:25 Error: Error rendering data template: UndefinedError: 'input_number' is undefined

I’m lost

alias: bla
description: ""
trigger: []
condition: []
action:
  - service: notify.persistent_notification
    metadata: {}
    data:
      message: "{{ states('input_number.test') }}"
  - service: input_number.set_value
    metadata: {}
    data:
      value: "123"
    target:
      entity_id: input_number.test
mode: single

to use the value of it in a template use states()

to manipulate an input_number, you need to use input_number methods, not number methods. use number methods to manipulate numbers. that’s why you aren’t getting the autocomplete. if you change to use input_number.set_value i suspect you will get autocomplete to show up for your entity.

Thanks, I meanwhile figured out too. Sometimes one has a bad day…

1 Like