Yes, or within one of the files included from it. The bit starting:
- trigger:
needs to be under the template:
heading in configuration.yaml
(docs), or within a file referenced from it (docs).
My file, for example, contains the line:
template: !include_dir_merge_list templates
so I would put the above snippet as it is in a file such as templates/scale.yaml
.