Syntax issues: moving a trigger based template binary sensor to a sensors.yaml file

I have the following configurations.yaml

sensor: !include sensors.yaml
Then inside sensors.yaml

- platform: template
  sensors:
    number_of_lights_on:
      unique_id: "number_of_lights_on"
      friendly_name: "Number of Lights On"
      icon_template: "mdi:lightbulb"
      value_template: >
        {{ 
            states.light
            |rejectattr('attributes.is_hue_group', 'true')
            |rejectattr('attributes.entity_id', 'defined')
            |selectattr('state','eq','on')
            |list
            |count  
        }}
    number_of_lights_on_in_lounge:
      unique_id: "lounge_number_of_lights_on"
      ...ETC
- platform: template
  trigger:
    - platform: time
      at: "00:00:00"
  binary_sensor:
    - name: Holiday
      state: {{ True }}

But this produces a parsing error

Configuration errors
Error loading /config/configuration.yaml: invalid key: "{True: None}"
  in "/config/sensors.yaml", line 40, column 0

That won’t work… they are different integrations. You need a separate file that uses the template top-level key.

template: !include templates.yaml
Then inside templates.yaml

- trigger:
    - platform: time
      at: "00:00:00"
  binary_sensor:
    - name: Holiday
      state: "{{ True }}"
1 Like

ah that makes sense! thank you. i’m very wonky about some basic stuff with home assistant