That message is vaguely familiar from long ago. I have a hazy recollection of having to do something goofy like putting at least one Trigger-based Template Sensor at the top so that Template Sensors and Template Binary Sensors don’t appear first.
Paste this freebie at the top of your templates.yaml file, reload and see if it makes any difference.
- trigger:
- platform: time
at: '00:00:00'
binary_sensor:
- name: 'Festive Season'
state: >
{% set m = now().month %}
{% set d = now().day %}
{{ m in [1,10,12] and
( (m == 12 and 1 <= d <= 31) or
(m == 1 and 1 <= d <= 10) or
(m == 10 and d == 31) ) }}
As an experiment I commented out the !include and pasted the entire file contents under template: > Still the same error. So now I’m really confused. Maybe it does not like the indentation?
I just cut the entire - sensor: portion out and only left the - binary_sensor: key. Same damn error.
Your template configuration is nearly identical to mine (except I have a few Trigger-based ones at the beginning of the file). I don’t get that error message.
The message refers to sensors (plural) but that’s not the option’s name (it’s sensor). Is it possible you have tradional sensors defined elsewhere?
Sorry, just realized that you want to store all 3 template.yaml inside /config, not /config/template. Probably you’ll need to change it to just sensor: !include template_sensors.yaml.
Furthermore, from the documentation, it is written-
Nesting !includes (having an !include within a file that is itself !included) isn’t going to work.
it needs to be -trigger: not template_trigger: and each triggered sensor/binary sensor has to start with -trigger:
EDIT: ayup,
Logger: homeassistant.config
Source: config.py:445
First occurred: 01:13:43 (1 occurrences)
Last logged: 01:13:43
Invalid config for [template]: [template_trigger] is an invalid option for [template]. Check: template->template_trigger. (See /config/configuration.yaml, line 162).
I don’t see any way to do the template triggered sensors.
Pretty sure that will generate a duplicate template: key error.
I don’t actually use triggered sensors as I find automations that publish retained mqtt messages and mqtt sensors initialise better after a restart. So I might just skip them.
In the off chance that I ever do need one I can bung it in configuration.yaml.
trigger:
- platform: time_pattern
# This will update every night
hours: 0
minutes: 0
sensor:
# Keep track how many days have past since a date
- name: Test
state: 'unavailable'
unit_of_measurement: "Days"
All sensors shows up fine including the trigger template.