Condition based on binary sensor attribute

Logic I am trying to get working below is as follows:-

When my light is ON
and my computer is LOCKED (via HA MacOS out of the box binary sensor)
and motion sensor has not had movement for 10 seconds
it switches off the light.

Narration:

I’ve just installed the MacOS version of HA. Since it comes with sensors I’m trying to ensure that the light switches off in my study when I am not sitting my computer (Kara). Therefore I would assume in the below that this should turn off my light when the computer is ‘Locked’. It doesn’t!!

My automation is like this:-

alias: 'OFF: Study Light and Kara off'
trigger:
  - entity_id: binary_sensor.downstairs_study_sensor_motion
    for: '00:00:10'
    from: 'on'
    platform: state
    to: 'off'
condition:
  - condition: state
    entity_id: light.downstairs_study
    state: 'on'
  - condition: state
    entity_id: binary_sensor.kara_active
    attribute: Locked
    state: 'true'
action:
  - data: {}
    entity_id: light.downstairs_study
    service: light.turn_off
initial_state: true
mode: restart

I can see via developer tools that Kara’s attribute Locked is true.

Fast User Switched: false
Idle: false
Locked: true
Screen Off: true
Screensaver: false
Sleeping: true
friendly_name: Kara Active
icon: 'mdi:monitor'

What I am missing? I’ve tried the same changing the state to ‘off’ which still doesn’t work.

Ideas?

Have you tried state: true where the word true is not wrapped in quotes? In theory, with quotes it’s handled as a string value, without them it should be handled as a boolean value.

Thanks, that works!!

The UI was actually adding the quotes, is this a bug. Even if I did not include the quotes they were added.
I needed to go into the automation.yaml file and remove them to get this working.

Bug logged: https://github.com/home-assistant/frontend/issues/8029