External template config file is ignored

Hi,

configuration.yaml:

template alexatimer: !include configuration/template-alexatimer.yaml

configuration/template-alexatimer.yaml

- sensor:
    - name: "Timer2 Wohnzimmer"
      state: >
                    {% if states('sensor.echo_wohnzimmer_next_timer')  != 'unavailable' %}
                      {{ ((as_timestamp(states('sensor.echo_wohnzimmer_next_timer')) - as_timestamp(now()))/60) | int + 1 }}
                    {% else %}
                        0
                    {% endif %}
      unit_of_measurement: Minutes
      icon: hass:timer

This is not working as no “Timer2 Wohnzimmer” sensor is created. No error in the logs, too. Semms like it is ignored completely. The same code copied to the template: section in configuration.yaml is working. Anyone an idea why the code does not work if seperated?

Have you tried

template alexatimer: !include template-alexatimer.yaml

?

I now moved my template-alexatimer.yaml to the same folder as configuration.yaml and used this:

template alexatimer: !include template-alexatimer.yaml

Still not working, no difference :cry:

Ah, I got it not before. You have a folder called „configuration“ (I mixed it up with the genuine „config“ folder). How did you bind your custom folder?

What do you mean with “bind”? Actually, I think that it isn’t related to the folder, as other integrations like the following are working as expected:

configuration.yaml

homematic: !include configuration/homematic.yaml

configuration/homematic.yaml

interfaces:
  rf:
...

Shorter example:

configuration.yaml

template:
  - sensor:
      - name: "Testsensor Intern"
        state: 3

template alexatimer: !include configuration/template-alexatimer.yaml

configuration/template-alexatimer.yaml

- sensor:
    - name: "Testsensor Extern"
      state: 3

Only “Testsensor Intern” and not “Testsensor Extern” shows up in Home Assistant. Why?

I know, it is in the documentation examples but I would try without the dash in the file name.

As an alternative, you might have a look at that discussion:

https://community.home-assistant.io/t/migrating-legacy-templates-to-the-new-template-section/305757/42