Sensor data type return not float

I’m trying to get a slider to update to show the correct volume for a media player (chromecast audio), the sensor works with the following code:

- platform: template
  sensors:
    chromecast_volume_kitchen:
      value_template: '{{ states.media_player.kitchen.attributes.volume_level | round(2) | float }}'
      friendly_name: 'chromecast volume'

The automation to then update the slider is as follows:

 alias: 'chromecast volume get'
  trigger:
    platform: state
    entity_id: sensor.chromecast_volume_kitchen
  action:
    service: input_slider.select_value
    data_template:
        entity_id: input_slider.chromecast_volume_kitchen
        value: >
          '{{ states.sensor.chromecast_volume_kitchen.state | float }}'

but I get the following error:

ERROR (MainThread) [homeassistant.core] Invalid service data for input_slider.select_value: expected float for dictionary value @ data['value']. Got "'0.18'"

I’m guessing that it isn’t reading it as a float, but as a string (or similar) but not sure how to fix this, is the sensor not actually storing a float despite the | float?

Thanks in advance.

Have you tried it without the quotes?
I think with the quotes HA reads it as string.