Hi I want to combine two automation into one, using templates. I’m completely new to templates, so I have no idea what I’m doing^^
Normally I make two automation to switch something on and off.
This is my Automation. Why its not working? Thx a lot.
I think your list of triggers needs "- platform: " for each platform statement.
Depending on which trigger triggers the action one of the triggers won’t be valid I think - however I could be wrong :P, I’m not really sure how HA processes the triggers in a template, maybe someone more experienced in templates can comment.
trigger is not an entity, the template does not know about what trigger is or what was the thing that triggered it. So you would basically have to do the same sun logic within your action if you want them combined.
Try using the dev tool: Templates and toss in your template.
{{trigger.event}} will throw an undefined error.
Pretty sure keeping them separate would be way more readable and less complicated.
trigger.eventis available when using the sun platform and automation templating, per the docs.
Trigger state objects are tough to debug though, because you can’t evaluate them in the templates dev tool (because there is no trigger in that case!).
@kolossboss did anything show up in the error log on info page of the front end under developer tools when the switch failed to turn on?