Syntax for template with trigger

Please format code blocks properly.

The current format (introduced nearly 4 years ago) for Template sensors needs to be under the top-level key template. As such, it cannot be placed in your sensors.yaml file, which you have set up to use sensor as the top-level key.

In you configuration.yaml file, add the line template: !include templates.yaml and create a file in the config folder called templates.yaml. Add all your “new format” template entities, like this trigger-based sensor, there.

1 Like