Change slider based on template value

I have a slider defined in helpers called tesla_current_slider, and want to change it in an automation action based on the value of a template.
However when trying this:

In configuration.yaml:

sensor:
 - platform: template
   sensors:
     test8:
       value_template: "{{ 8 | float }}"

In an automation action:

service: input_number.set_value
data:
  value: {{ test8 | float }}
target:
  entity_id: input_number.tesla_current_slider

expected float for dictionary value @ data[‘value’]. Got None

or like this:

service: input_number.set_value
data:
  value: "{{ test8 | float }}"
target:
  entity_id: input_number.tesla_current_slider

Error rendering data template: UndefinedError: ‘test8’ is undefined

I’ve tried a lot of things, but none seem to work. Is it possible to use it like this?

You don’t get the state of your template sensor with {{ test8 }}.
Try {{ states('sensor.test8') | float }}

So simple, but didn’ t figure out how to do it.

Thank you so much!