"Condition" Trigger

I would like to suggest a new trigger to which one can add multiple conditions and that fires as soon as all conditions are met.
Example: You want a light to turn on as soon as the sun is down AND John is home AND it is after 20:00. At least for me, automations like this are pretty common. Currently you would have to create (and eventually edit) an automation with 3 triggers and 3 conditions to achieve this behaviour.* With the proposed trigger you would only need the one trigger (containing the 3 conditions).

*Edit: Or write YAML in the form of a condition trigger, as pointed out by @123.

Currently possible with a single Template Trigger.

True, but that requires writing YAML which, IMHO, should not be necessary for such a simple and common use case.
Also, is there any documentation on how to use a Template Trigger in this way?

It’s Jinja2. Home Assistant use the Jinja2 templating language.

Yes, in Home Assistant’s documentation.

Automation Trigger - Home Assistant (home-assistant.io)


Example

sun is down AND John is home AND it is after 20:00

Reference
Templating

As of 2023.9 you can create template binary sensors in the UI.

You could create one of those, and use that in a state trigger.

Okay, but that’s not my point. Writing code, in whatever language, should not be necessary.

Kind of, but in order to build what I suggested with the information given in https://www.home-assistant.io/docs/automation/trigger/#template-trigger, you still need to know Jinja2. Something like the example you gave (Thank you for that!) cannot be found there. (Of course that’s fine, as there can hardly be examples for every conceivable use case of the Template Trigger in the docs.)

Yes, but this still requires writing code and creating a helper in addition to the automation, so that’s not very elegant.

Don’t get me wrong, I don’t think there’s anything wrong with writing code to achieve this. And if that is what works best for you, that’s great! But with home automation becoming more and more mainstream, I think having a more intuitive and beginner friendly option for this, is a good idea.

‘Should not be necessary but there’s nothing wrong with it’.

In that case, it would benefit you to learn how Home Assistant uses Jinja2 in triggers, conditions, actions and elsewhere. A worthwhile investment of your time because the majority of Feature Requests are never implemented.

2 Likes

Seldom are projects like this beginner friendly.

Although, the HA volunteer devs have done an amazing job at it, don’t expect it to always go that way.

Just saying.