Trigger Automation by Attribute containing space

I am writing an automation that will trigger if an attribute of a state changes. I can trigger the automation if the attribute is one word - i.e. “Charles”, but when the attribute contains two words seperated by a space- i.e. “Charles Smith” it will not trigger. Can I change some how to make the automation trigger when the attribute contains a space? I tried “Charles Smith” and ‘Charles Smith’ - but it did not work

Show your automation code, please.

Code is below

 id: '1635281476068'
  alias: test
  description: ''
  trigger:
  - platform: state
    entity_id: lock.maindoor
    id: trst23
    attribute: changed_by
    to: Charles Smith
  condition: []
  action:
  - scene: scene.tand_huset
  - service: spotcast.start
    data:
      uri: spotify:playlist:146XtgzZNuYEVZdvpAh7O1
      random_song: true
      shuffle: true
      start_volume: 20
      device_name: Love
  mode: single

Get “Charles Smith” to change the lock and look in Developer Tools / States. What is the actual value of the changed_by attribute?

It is Charles Smith in Developer tools.
However, if I change the trigger in the automation to Charles I can fire the rule from the Developer Tools by using “changed_by: Charles”; But if I change the automtion trigger to Charles Smith I can not fire the rule in Developer Tools by using “changed_by: Charles Smith”

What does the template tool say?

{{ state_attr('lock.maindoor', 'changed_by') }}
{{ state_attr('lock.maindoor', 'changed_by')  == "Charles Smith" }}
{{ state_attr('lock.maindoor', 'changed_by')[0:7]  == "Charles" }}
{{ state_attr('lock.maindoor', 'changed_by')[9:13] }}
{{ state_attr('lock.maindoor', 'changed_by')[9:13]  == "Smith" }}
{{ state_attr('lock.maindoor', 'changed_by')[0:13]  == "Charles Smith" }}

This should probably give us some clues what is gong on.