Trigger-based Template Sensors in Configuration Package not working

Hi all,

I have just upgraded to 2021.4.1 and found the trigger based template sensors very useful (Awesome work by the way). It will allow me to get rid of a custom component I’ve been using.

Only problem is that the configuration only seem to work in the configuration.yaml file and not in sub configuration Package files.
I get the following error when placing the config in a Package file:
Package ... setup failed. Component template cannot be merged. Expected a dict.
I have tried to place it under homeassistant: the way customization work in Packages but then it doesn’t give me an error but also doesn’t work.

Any Idea on how to configure Trigger Template Sensors in a Package?

Thanks

1 Like

You should probably add the properly formatted code you are using for the trigger template sensor from the package.

maybe it’s just a syntax issue.

just noticed this too, and file an issue, before having read your post here.Trigger based template error in Package: Component template can not be merged · Issue #49212 · home-assistant/core · GitHub

Maybe you can add to the issue? Seems unforeseen the packages wouldn’t work, but as I have just discovered adding all sensors to the configuration.yaml makes the config check ok.
Hope this gets fixed any time soon. Never have had such a huge configuration.yaml :wink:

I’ve got the same issue, can’t switch to the new template syntax as my code is all split into packages.
Can’t wait for it to be supported within packages.

as an intermediary solution to keep your configuration.yaml clean, you can use:

template: !include template.yaml

and add all the trigger based templates in that file

I hadn’t had the time to explore this new feature, yet, but could someone be so nice and explain this a liitle more to me?

You try to use

template:
  - trigger:
...

in a package file, let’s say light_package.yaml and this doesn’t work. If you put the same in configuration.yaml or in an included file, like @Mariusthvdb posted, it is working?

Did anybody try to use it by putting template: into configuration.yaml and just use it again in the package file? Did that work?

just so you know: Allow integration template: in packages
please add support if your needs require it

Already did… :smiley: