Right location binary_sensor template

Hi.
I have my configuration split into multiple yaml files. I have created a binary sensor template.
I had placed it in the binary sensor file. But it threw me a syntax error.
For now I put it in the ‘configuration.yaml’ file. So which is the right mode?
Thanks

template:
  - binary_sensor:
      - name: someone_is_home
        state: >
          {{ is_state('person.ros', 'home')
             or is_state('person.mary', 'home')
             or is_state('person.andrew', 'home')
             or is_state('person.marc', 'home') }}
      - name: nobody_is_home
        state: >
          {{ is_state('person.ros', 'not home')
             and is_state('person.mary', 'not home')
             and is_state('person.andrew', 'not home')
             and is_state('person.marc', 'not home') }}

That’s the section it belongs in, nothing else.

Hi Petro. Thanks for your replay.
So I have to leave it in ‘configuration.yaml’ can’t I group them all into one yaml file to include? Did I understand well? Such as: template: !include …

You can separate them using !include. Make sure to remove the word template: in the file you move them to.

1 Like

By the way: Is absent state actually ‘not home’ without _ ? (mine is not_home )

1 Like

yep, i’m assuming that doesn’t work for op

yes you are right, I correct