Help with automation condition template attribute

I’ve configured the Google calendar integration and my automation works when I use just a trigger on a calendar event, however, when I add a condition to use the calendar event title the automation fails to work.

My automation is

- id: '1591669555874'
  alias: Test Calendar Automation
  description: ''
  trigger:
  - entity_id: calendar.automation
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: template
    value_template: '"{{state_attr(''calendar.automation'', ''message'', ''Test'')
      }}"'
  action:
  - data: {}
    entity_id: switch.47272787a4cf12b50632_4
    service: switch.turn_on

The state attributes show calendar.automation is correct and the event message is Test

My original automation had

value_template: "{{is_state_attr('calendar.automation', 'message', 'Test') }}"

as per the HA Integration page but that didn’t work either. Does anyone have any ideas what’s wrong with my code?

That was the correct format. This is not:

value_template: '"{{state_attr(''calendar.automation'', ''message'', ''Test'')

There is no third value for state_attr.

try multi-line notation:

value_template: >
  {{is_state_attr('calendar.automation','message','Test')}}

to be sure you don’t suffer quoting issues…
and use the /developer-tools/template to test your template :wink:

Thanks, the issue seems to be I’m writing the automation via the GUI but its writing the code with extra quotes.

value_template: '"{{state_attr(''calendar.automation'', ''message'', ''Test'')
      }}"'

When I correct the automations.yaml it works