Trouble using template values in event based automation trigger

I’m having trouble getting automations to work when using template values with event triggers. In the below example the sensor sensor.bedroom_keyboard_remote_device_number is a command line platform sensor that gives the proper linux USB input device name using the command
printf "/dev/input/" ; ls -l /dev/input/by-id/usb-HAOBO_Technology_USB_Composite_Device_1120030400060620-if02-event-kbd | cut -d\> -f2 | cut -d\/ -f2
and this is the automation I was trying to use with it:

- id: 'Harmony replacement bedroom down'
  alias: Harmony replacement bedroom down
  trigger:
    - platform: event
      event_type: keyboard_remote_command_received
      event_data:
        device_name: "HAOBO Technology USB Composite Device Keyboard"
        device_descriptor: '{{ states.sensor.bedroom_keyboard_remote_device_number.state }}'
        type: key_down
        key_code: 108
  action:
    - service: script.bedroom_appletv_down

This would allow me to have multiple remotes using the keyboard remote integration of the same brand/model plugged into the USB ports on the HA machine without mixing commands between AV equipment in different rooms. Any way I can verify the linux USB input device name using this command line sensor? I want it to verify with this sensor because it has been made to adapt even if the device event number changes with a reboot of the machine.

Found my answer, I just needed to take the device_descriptor part out of the trigger portion and make a template condition that can check to see if the command came from a device with the same descriptor as the one my command line sensor defined.

sensor:
  - platform: command_line
    command: printf "/dev/input/" ; ls -l /dev/input/by-id/usb-HAOBO_Technology_USB_Composite_Device_1120030400060620-if02-event-kbd | cut -d\> -f2 | cut -d\/ -f2
    name: Bedroom keyboard remote device number
    unique_id: bedroom_keyboard_remote_device_number
    scan_interval: 10
    command_timeout: 10

automation:
  - id: 'Harmony replacement bedroom down'
    alias: Harmony replacement bedroom down
    trigger:
      - platform: event
        event_type: keyboard_remote_command_received
        event_data:
          device_name: "HAOBO Technology USB Composite Device Keyboard"
          type: key_down
          key_code: 108
    condition:
       - condition: template
         value_template: >
           {{ trigger.event.data.device_descriptor == states.sensor.bedroom_keyboard_remote_device_number.state }}
    action:
      - service: script.bedroom_appletv_down