Trigger when an entity with a label changes. My Solution

Ok, so this is what i’ve got. Return the last changed item with a label.

Helper

{% set entities = label_entities('chime') %}
{% set ns = namespace(latest_time=None, last_changed_entity=None) %}

{% for entity in entities %}
    {% set last_changed = states[entity].last_changed %}
    {% set entity_id = states[entity].entity_id %}

    {% if states[entity].last_changed != 'Unavailable' and (ns.latest_time is none or last_changed > ns.latest_time) %}
        {% set ns.latest_time = last_changed %}
        {% set ns.last_changed_entity = entity_id %}
    {% endif %}
{% endfor %}

{{ ns.last_changed_entity }}

Example Automation

alias: Trigger by label
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.last_chime
conditions: []
actions:
  - variables:
      last_device: "{{ states.sensor.last_chime.state }}"
      device: "{{ states[last_device].state }}"
mode: single

Hope this helps.
Feedback apriciated.

The problem with this method is that the template entity doesn’t change, and therefore the automation doesn’t trigger, when the same entity is changed twice (or more) without other entities changing in between.

The way to avoid this is by moving to a trigger-based template sensor, and triggering when any of the labeled entities are updated. This becomes complicated quickly, but here is a solution that should work. It has a state that is a timestamp of the last_changed property of the last changed entity, and it will have an attribute called trigger_entity which is the entity which has the most recent change. After adding this to your YAML, you will have to restart HA because that will cause it to trigger it for the first time.

  - trigger:
      - platform: template
        value_template: >
          {% set expanded_entities = label_entities('lighting') | expand | rejectattr('state', 'in', ['unavailable', 'unknown']) | list %}
          {% set entity_table_new = zip(expanded_entities | map(attribute='entity_id') | list, expanded_entities | map(attribute='last_changed') | map('string') | list) | sort(attribute=1, reverse=true) | list %}
          {% set entity_table_old = state_attr('sensor.last_changed_label_entity', 'entity_table') %}
          {{ entity_table_new != entity_table_old }}
      - platform: homeassistant
        event: start
    action:
      - variables:
          entity_table: >
            {% set expanded_entities = label_entities('lighting') | expand | rejectattr('state', 'in', ['unavailable', 'unknown']) | list %}
            {{ zip(expanded_entities | map(attribute='entity_id') | list, expanded_entities | map(attribute='last_changed') | map('string') | list) | sort(attribute=1, reverse=true) }}
    sensor:
      - name: Last Changed Label Entity
        device_class: timestamp
        state: "{{ entity_table[0][1] }}"
        attributes:
          entity_table: "{{ entity_table }}"
          trigger_entity: "{{ entity_table[0][0] }}"

There are less complicated ways to do this, but they won’t be as responsive as this method. In other words, a much simpler implementation is possible if you are ok with it only updating once per minute, rather than immediately upon an entity changing.

I did find that the template method did update when running in dev tools and as a helper it did trigger automations.
Thanks for the feedback, I’ll look into your way.