Help triggering automation when any one of many door sensors is opened

Hi All

I recently setup Xiaomi door sensors with my HA install, for the price they seem to work great.
I am trying to wrap my head around how to trigger an action if any of my 5 door sensors are opened. Triggering events on one sensor’s state change I understand, but I can’t seem to figure out how to group them as a whole and trigger events if any one of the sensors are open.

I would like to get HA to send me a notification when any door is opened and we are out of the house. (I use my unify controller for presence control)

And I would like to get a Philips Hue light to turn Red if any doors are left open at night for more than 10 minutes. Just as a visual cue that one of the doors need to be closed.

Thanks so much for the help!
Cheers
Chris

Put them in a group, use the group in the trigger, is the simplest.

Thanks for the response I did not realize it was that easy.

So for example, if I put them all in the same group, and only one door is opened and has a state change from off to on, the whole group will then have a state of ON? Regardless of the 4 other doors that are closed.

Yup

When you group lights, switches, and sensors when any of them goes on, the whole group is on. Similarly if you group device trackers, when any entity in the group is home then the group is `home.

oh ok, i didn’t realize it worked like that with all items. Thanks so much for the help :slight_smile:

A more complicated method is using a trigger template. I put it here for reference for other automations. This will look for binary sensors that end with “door” and if any are “on” then it will be “True” / trigger

{% for state in states.binary_sensor if state.state == 'on' if state.entity_id.endswith('door') -%}
         {% if loop.first %}    
{% if loop.length   %}True{% else %}False{% endif %}
          {% endif %}  
 {% else %}      
False
{% endfor %}

Thanks, Rob

The more examples the better, especially when your new to Home assistant