How to compute wallbox value in yaml

I tested to calculate the value of the current for our Quasar wallbox in the developer tools environment and it worked fine:

{{ (states('sensor.wallbox_portal_max_charging_current')|float) + 1 }}

However, if I use it in my yaml automation, I get an error message.

This is the yaml code:

  - device id: <id>
    domain: number
    entity_id: <id>
    type: set_value
    value: >
      {{ (states('sensor.wallbox_portal_max_charging_current')|float) + 1 }}

This is the error message, when I try to save the code:

Message malformed: expected float at 'value'
What did I wrong?

Device actions don’t always support templating, use the number.set_value action.

  - action: number.set_value
    target:
      entity_id: <id>
    value: >
      {{ (states('sensor.wallbox_portal_max_charging_current')|float) + 1 }}

Thanks, it works fine!