Need some template help!

I’ve had this value template for quite awhile and noticed lately that it hasn’t been working. It’s purpose is to read the value/name returned from a fingerprint scanner and set that value/name to an input text. I’ve read that data_template is no longer working so I suspect it has something to do with this but I have very limited knowledge on scripting.

Below is my original (non-working) template:

  - alias: Fingerprint Scanner - User Identity
    description: ''
    trigger:
    - platform: mqtt
      topic: "/fingerprint/mode/status"
      value_template: "{{ value_json.state }}"
      payload: Matched
    condition: []
    action:
      - service: input_text.set_value
        data_template:
          entity_id: input_text.last_garage_user
          value: >
            {% if is_state('sensor.fingerprint_person', 'Mark') %}               
              Mark  
            {% elif is_state('sensor.fingerprint_person', 'Jean') %}
              Jean
            {% elif is_state('sensor.fingerprint_person', 'Alexis') %}
              Alexis
            {% elif is_state('sensor.fingerprint_person', 'Ashley') %}
              Ashley         
            {% else %}
              Error
            {% endif %}     
    mode: single   

I decided I would give ChatGPT a chance to fix and it returned this, but it doesn’t work either. Anyone template experts here smarter than ChatGPT? lol

- alias: Fingerprint Scanner - User Identity
  description: ''
  trigger:
    - platform: mqtt
      topic: "/fingerprint/mode/status"
      value_template: "{{ value_json.state }}"
      payload: "Matched"
  condition: []
  action:
    - service: input_text.set_value
      target:
        entity_id: input_text.last_garage_user
      data:
        value: >-
          {% set p = states('sensor.fingerprint_person') %}
          {{ p if p in ['Mark','Jean','Alexis','Ashley'] else 'Error' }}
  mode: single

Regarding the trigger:

Is this automation triggering? If so, what does the debug Trace show? If it isn’t triggering, you need to check that nothing has changed with the MQTT topic and/or payload.

Regarding the Action:

Both templates look fine, and should be functionally the same.

While the older keys like service, data_template, and platform are not the current syntax, AFAIK all of those are still supported. In the current syntax the automation would be:

- alias: Fingerprint Scanner - User Identity
  description: ''
  triggers:
    - trigger: mqtt
      topic: "/fingerprint/mode/status"
      value_template: "{{ value_json.state }}"
      payload: "Matched"
  conditions: []
  actions:
    - action: input_text.set_value
      target:
        entity_id: input_text.last_garage_user
      data:
        value: >-
          {% set p = states('sensor.fingerprint_person') %}
          {{ p if p in ['Mark','Jean','Alexis','Ashley'] else 'Error' }}
  mode: single