Notify Automation for both Group and Group Entities

- alias: "Lights Changed - Individual"
  hide_entity: False
  trigger:
    platform: state
    entity_id: light.entryway__hall,light.island_trio,light.bathroom_hall,light.bedroom_lamp
  action:
    service: joaoapps_join.nick_nexus6_send_tasker
    data_template:
      command: >-
        {%- if trigger.entity_id == "group.lights" -%}
          setvar=:={{ trigger.entity_id }}=:={{ trigger.to_state.state }}
        {%- else -%}
          {%- for state in states.light if state.entity_id == trigger.entity_id -%}
            setvar=:={{ trigger.entity_id }}=:={{ trigger.to_state.state }}
          {%- endfor -%}
        {%- endif -%}

# - alias: "Lights Changed - Group"
#   hide_entity: False
#   trigger:
#     platform: state
#     entity_id: group.lights
#   action:
#     service: joaoapps_join.nick_nexus6_send_tasker
#     data_template:
#       command: "setvar=:={{ trigger.entity_id }}=:={{ trigger.to_state.state }}"

Hi!

Above I have two examples of a notification, and both work great individually! The problem I’m running into is if I have just “Lights Changed - Group”, then I don’t get the individual notifications which is not very useful. Conversely, if I add group.lights into the “Lights Changed - Individual”, whenever you change the state of the group.lights, the individual entities trigger the automation as well! I assume this is because changing the group just issues a call to each entity within the group to change.

Oddly enough, it appears that a change in a group does not happen before the individual entities do. I assume this is because HASS bundles state changes together in a data container that does not care about order (dict maybe?) and only pushes the information at set intervals.

This presents a small problem in notify automation, and I’m not exactly sure how to fix it! Does anyone have any ideas?