Number/set.value - Float Error

So I’m trying to use a Helper so I can store the state of the number of portions I would like the Cat Feeder to feed my cat, I can manipulate the helper with a slider and it works perfectly, but when I try to use the helper variable into the Cat Feeder (Tuya Integration) it throws an error:

number/set_value. expected float for dictionary value @ data[‘value’]

I’ve read multiple posts that instructed me to use the | float conversion, but it still throws the same error.

This is the Code from my Lovelace UI Card:

  - type: custom:mushroom-number-card
    entity: input_number.cat_feed_portion
    name: Define Portion
    display_mode: buttons
    icon_color: green
    tap_action:
      action: call-service
      service: number.set_value
      target:
        device_id: number.cat_feeder
      data:
        value: '{{ states(''input_number.cat_feed_portion'') | float }}'

I know that using '{{ states(''input_number.cat_feed_portion'') | float }}' on a blank card displays the portion I set/change on the slider, but I don’t see a decimal point on it.

Neither float / int works at the end of the sentence, but replacing the states as a whole by ‘4’ works and the cat feeder spins around.

Thanks in advance.

Templates are not supported in most cards, and even cards that accept templates elsewhere will often not accept them in actions. If you need templated logic for your action, you need to set up the logic in a script then have the card action call the script as a service.

Thanks for the context, appreciated.

P.S.: For those wondering, the solution came from using a Script (which expects a param to call the number.set_value using it), then using an automation that captures the Helper input and passes to the script and lastly on the lovelace UI I simply call the automation. More can be found on the link: Passing variables to a script from an automation