The data to send to script as parameter is not getting evaluated

I am trying to send the state of the sensor, instead, it is sending the whole thing. However, it just seems to send the whole command instead of evaluating the state

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: button.tp_link_controller_command_execute
    icon: mdi:block-helper
    icon_color: red
    content: null
    tap_action:
      action: call-service
      service: script.omada_command_execute
      service_data:
        data: states("sensor.tp_link_router_clients")
      target: {}

I checked, the data is passed as states(“sensor.tp_link_router_clients”) instead of the count

Most cards do not accept templates, even those that do rarely accept them in actions. This is the case with Mushroom chips Card. Even if it did, that’s not a template, it’s just a string. You can pass the entity ID string, then process it in the script.