Input_number.increment + entity_id with a variable

Hello

I have an issue in the log when I try to use a variable in the name of an entity_id I want to increment.

For example

    piecefrom: "{{ trigger.from_state.state }}"
#
  - service: input_number.decrement
    entity_id: "input_number.personne_{{piecefrom}}"

I haven’t found how to use a data_template or sthing like that.

The error in the log is the following : " Invalid config for [automation]: not a valid value for dictionary value @ data[‘action’][2][‘entity_id’]. Got None. (See ?, line ?)"
which does not help

Is it possible to use variable in the name of the entity_id ?
Thanks for the help

the entity_id can only be templated in the data section or in the target section on a service call.

Yes but only in the manner petro explained. Here’s an example:

  - service: input_number.decrement
    target:
      entity_id: "input_number.personne_{{piecefrom}}"

Many thanks
I didn’t notice that target was missing.