Having trouble getting trigger slot variables to pass to shell command

I am trying to get an automation to work that would send 2 variables to a shell command, then use the response variable in conversation.

Everything seems to be working with the exception of passing the variables. I can see in the trace where the trigger.slot variables are set, but I can’t get them to send to the shell command.

alias: Get Player Number
description: ''
triggers:
  - trigger: conversation
    command:
      - >-
        (who's | who is | whose | who was) [number] { playerNumber }
        (for|on|in|with) [the] { teamName }
conditions: []
actions:
  - action: shell_command.get_player_data
    metadata: {}
    data:
      number: "{{ trigger.slots.playerNumber }}"
      team: "{{ trigger.slots.teamName }}"
    response_variable: message
    enabled: true
  - set_conversation_response: "{{ message['stdout'] }}"
    enabled: true
mode: single

The trace for the automation shows the variables I am trying to send in the sentence, but blank for what gets sent to the shell command.

this:
  entity_id: automation.get_player_number
  state: 'on'
  attributes:
    id: '1776972004597'
    last_triggered: '2026-04-30T14:02:27.644885+00:00'
    mode: single
    current: 0
    friendly_name: Get Player Number
  last_changed: '2026-04-30T13:50:31.363581+00:00'
  last_reported: '2026-04-30T14:02:27.859159+00:00'
  last_updated: '2026-04-30T14:02:27.859159+00:00'
  context:
    id: 01KQFB5DXWP1GR7XXBRVGRR9CF
    parent_id: null
    user_id: null
trigger:
  id: '0'
  idx: '0'
  alias: null
  platform: conversation
  sentence: ' Who''s thirty-seven on Carolina?'
  details:
    ' playerNumber ':
      name: ' playerNumber '
      text: thirty-seven
      value: thirty-seven
    ' teamName ':
      name: ' teamName '
      text: Carolina
      value: Carolina
  slots:
    ' playerNumber ': thirty-seven
    ' teamName ': Carolina
  device_id: 7176d37021b8f1da66199024dabc4649
  satellite_id: null
  user_input:
    text: ' Who''s thirty-seven on Carolina?'
    context:
      id: 01KQFB5RMGE999MTJDP01GTG8G
      parent_id: null
      user_id: 7d65a15113734c1bb7964c4610ecbd59
    conversation_id: 01KQFB534D350J0H57Y50FZCAN
    device_id: 7176d37021b8f1da66199024dabc4649
    satellite_id: null
    language: en
    agent_id: conversation.home_assistant
    extra_system_prompt: null

But what gets sent to the shell command

Shell Command 'shell_command.get_player_data'
Executed: April 30, 2026 at 10:02:43 AM
Result:

params:
  domain: shell_command
  service: get_player_data
  service_data:
    number: ''
    team: ''
  target: {}
running_script: false

From the threads I’ve read while searching this, I thought this would work. The shell script runs, and I get my response text, but without the variables being sent the curl script doesn’t get what it needs. I’ve tested with hardcoding the variables, and that sends the commands and gives expected results. I just can’t seem to figure out what I’m doing wrong to prevent the variables to get sent from the conversation. Any help would be greatly appreciated, and if I need to provide any other information, please let me know.

Your slot keys have leading and trailing spaces, maybe try:

    action: shell_command.get_player_data
    metadata: {}
    data:
      number: "{{ trigger.slots[' playerNumber '] }}"
      team: "{{ trigger.slots[' teamName '] }}"

Or try addressing it from the other direction by removing the spaces in the sentence template:

triggers:
  - trigger: conversation
    command:
      - >-
        (who's|who is|whose|who was) [number] {playerNumber}
        (for|on|in|with) [the] {teamName}
1 Like

THANK YOU SO MUCH!!!

I have been pulling my hair out for days, and it was staring me in the face the whole time. I think I have been making this mistake in other places as well, so you helped me fix a lot more than just this. Thank you again.