Formatting template sensors with trigger

I feel like an idiot for having to ask this, but can someone help me with how to format a template sensor with trigger in a template.yaml file? Before I try to get started with the sensor I really want, I experimented with the example from Template - Home Assistant.

I tried updating it, based on Adding trigger based template to a templates.yaml file? - #4 by Scott8586

I also tried copying in a random example from Automation Trigger - battery_level for a device - #2 by 123

Can someone help me with formatting my code or sharing one of your own examples of a template trigger that works in template.yaml? Seeing a working example would really help me with understanding the logic.

- trigger:
    - trigger: time_pattern
      # This will update every night
      hours: 0
      minutes: 0
    sensor:
    # Keep track how many days have past since a date
    - name: "Not smoking"
      state: '{{ ( ( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(default=0) }}'
      unit_of_measurement: "Days"
- trigger:
    - trigger: time_pattern
      hours: 0
      minutes: 0
  sensor: ### no dash in front of this ###
    - name: "Not smoking"
      state: '{{ ( ( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(default=0) }}'
      unit_of_measurement: "Days"

No dash in front of “sensor”, just like the example in the documentation: https://www.home-assistant.io/integrations/template/#trigger-based-template-binary-sensors-buttons-images-numbers-selects-and-sensors

Hi Tom!

I made a mistake with coping the code in my post, apologies. I have edited my original post so the code is the same as the screenshot.
As you can see in the screenshot, removing the dash does not solve the issue.

Your indentation of “sensor:” is not correct. It needs to line up with “trigger:” Look at the example again.

This:

- trigger:
    - trigger: time_pattern
      # This will update every night
      hours: 0
      minutes: 0
  sensor: 
    - name: etc...

Not this:

- trigger:
    - trigger: time_pattern
      # This will update every night
      hours: 0
      minutes: 0
    sensor: 
    - name: etc...

This is also showing errors:


If there’s a list of template sensors (starting at line 10), is it perhaps not possible to also have a trigger template sensor in the same file?