Input_select -- set a Number but i need the output as String

Hello,

i have a Input_select, i set over a button a Value to the input_select, i must set a Number 1-4 for a ptz control, when i set a number the result always get a Number.

i tested the Input_text but there is the same, i always get when i set a value a Number.
Is it possible to set a number but save it as a string?

or request it as a string in a automation?

here my input_text code

action: call-service
              service: input_text.set_value
              data:
                entity_id: input_text.cam_kinderzimmer_ptz
                value: 
                  - '3'
input_text:
  cam_kinderzimmer_ptz:
    name: PTZ_Control_Kinderzimmer

my tests with the request

{{ states('input_text.cam_kinderzimmer_ptz') | string }}
{{ states('input_text.cam_kinderzimmer_ptz') }}
{{ states.input_text.cam_kinderzimmer_ptz.state }}

ym automation code for requesting the state

message: |-
    {
      "messageId": "cmdPanAndTiltUp", 
      "command": "device.pan_and_tilt",
      "serialNumber": "xxxxx",
      "direction":  {{ states.input_select.cam_kinderzimmer_ptz.state }}
    }  

i tried it with a script

script

service: eufy_security.send_message
data:
  message: |-
    {
      "messageId": "cmd Pan And Tilt Down", 
      "command": "device.pan_and_tilt",
      "serialNumber": "T8410P3121302681",
      "direction": {{ direction }}
    }

my button where i set the {{ direction }}

- type: custom:webrtc-camera
        entity: camera.kinderzimmer
        ui: true
        ptz:
          service: script.ptz_kinderzimmer
          data_left:
            direction: >
                    {{ "{}\x00".format(1)[0:]}}

i tried it with this {{ “{}\x00”.format(1)[0:]}} because i read in another thread that makes a number to string, it works but he always says it must be a str

because he added a space behing the number, when i remove the space its a NUMBER :weary:

no one?

i dont get it to work

i tested this too, but when i use a if condition he always makes the string to a number.

 service: eufy_security.send_message
data:
  message: |-
    {
      "messageId": "cmd Pan And Tilt Down", 
      "command": "device.pan_and_tilt",
      "serialNumber": "XXXX",
      "direction": >
          {% if direction == "left" %} 2
          {% endif %}
    }

when i remove the if and wrote a single 2 it works well