Trigger state attribute as condition

How to use an Automation trigger attribute as a template condition?
Trying to have an automation to run only if the TRV that triggers the automation is not off.
This is my attempt:
“{{ state_attr( ‘{{ trigger.entity_id }}’ , ‘system_mode’) != off) }}”

But i get the following error:
Message malformed: invalid template (TemplateSyntaxError: unexpected ‘)’) for dictionary value @ data[‘condition’][0][‘value_template’]

You don’t need to nest templates, just use the variable as-is:

condition: template
value_template: >
  {{ state_attr( trigger.entity_id, 'system_mode') != 'off' }}

EDIT: Extra ) removed

I believe there is also an extra ) after 'off'.

This did the trick.
I noticed that the > is important as well, without this I still got the error:
value_template: >
{{ state_attr( trigger.entity_id, ‘system_mode’) != ‘off’ }}

In case you want to know why the > was necessary, here is a good interactive tool that shows the different options and how they work.

Long story short, templates have to be in strings, and that marks the following lines as a string.