Using notify.notify to broadcast available updates for multiple devices

I have a few Ubiquiti devices that I would like to receive notifications for if any or all devices have updates. Currently, all 3 devices have updates available, so I’m using this opportunity to build an automation to test sending notifications via notify.notify.

Right now, I’m not receiving anything. I’m also realizing that if/then is not the way to go because if either #1 or #2 is true it will break the automation. How do I check all 3 devices and send individual notifications for each?

automation:
  - alias: "Check for Unifi device updates"
    trigger:
      platform: template
      value_template: >
        {{ is_state('update.udm_pro', 'on') or
           is_state('update.ubiquiti_uap6mp_1', 'on') or
           is_state('update.ubiquiti_uap6mp_2', 'on') }}
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.unifi_updates_available
      - service: notify.notify
        data_template:
          title: "Unifi Update Available"
          message: >
            {% if is_state("update.udm_pro", 'on') %}
              The {{ state_attr(update.udm_pro, 'friendly_name') }} has an update from {{ state_attr(update.udm_pro, 'current_version') }} to {{ state_attr(update.udm_pro, 'latest_version') }}
            {% elif is_state("update.ubiquiti_uap6mp_1", 'on') %}
              The {{ state_attr(update.ubiquiti_uap6mp_1, 'friendly_name') }} has an update from {{ state_attr(update.ubiquiti_uap6mp_1, 'current_version') }} to {{ state_attr(update.ubiquiti_uap6mp_1, 'latest_version') }}
            {% elif is_state("update.ubiquiti_uap6mp_2", 'on') %}
              The {{ state_attr(update.ubiquiti_uap6mp_2, 'friendly_name') }} has an update from {{ state_attr(update.ubiquiti_uap6mp_2, 'current_version') }} to {{ state_attr(update.ubiquiti_uap6mp_2, 'latest_version') }}
            {% else %}
              Error message
            {% endif %}

Easiest would be to change the single if-elif-elif-else-endif to three if-endif.

I removed the input_booleans as they were duplicative/irrelevant, and changed it from a package to an automation. I also adjusted the message format to three if-endifs, but it’s still not triggering.

When I paste it into the template editor, it says UndefinedError: 'update' is undefined. Do I need to reconfigure the data_template?

- id: '1675848895522'
  alias: "Check for Unifi device updates"
  trigger:
    platform: template
    value_template: >
      {{ is_state('update.udm_pro', 'on') or
         is_state('update.ubiquiti_uap6mp_1', 'on') or
         is_state('update.ubiquiti_uap6mp_2', 'on') }}
  action:
    - service: notify.notify
      data_template:
        title: "Unifi Update Available"
        message: >
          {% if is_state("update.udm_pro", 'on') %}
            The {{ state_attr(update.udm_pro, 'friendly_name') }} has an update from {{ state_attr(update.udm_pro, 'current_version') }} to {{ state_attr(update.udm_pro, 'latest_version') }}
          {% endif %}
          {% if is_state("update.ubiquiti_uap6mp_1", 'on') %}
            The {{ state_attr(update.ubiquiti_uap6mp_1, 'friendly_name') }} has an update from {{ state_attr(update.ubiquiti_uap6mp_1, 'current_version') }} to {{ state_attr(update.ubiquiti_uap6mp_1, 'latest_version') }}
          {% endif %}
          {% if is_state("update.ubiquiti_uap6mp_2", 'on') %}
            The {{ state_attr(update.ubiquiti_uap6mp_2, 'friendly_name') }} has an update from {{ state_attr(update.ubiquiti_uap6mp_2, 'current_version') }} to {{ state_attr(update.ubiquiti_uap6mp_2, 'latest_version') }}
          {% endif %}

You are missing the quote marks, that should be:
{{ state_attr('update.udm_pro', 'friendly_name') }}

Thanks. It appears that I missed single quotes in a few other places as well.

I changed the code a bit more, and this is what I wound up with. The template editor is now coming back with meaningful output. Thanks, all!

- id: '1675848895522'
  alias: "Check for Unifi device updates"
  description: Check for Unifi device updates
  mode: single

  trigger:
    - platform: state
      entity_id:
        - update.udm_pro
        - update.ubiquiti_uap6mp_1
        - update.ubiquiti_uap6mp_2
      from: "off"
      to: "on"
    - platform: time
      at: "08:00:01"

  condition: 
    - condition: time
      after: "08:00:00"
      before: "21:00:00"
    - condition: template
      value_template: >-
        {{ expand(['update.udm_pro',
        'update.ubiquiti_uap6mp_1',
        'update.ubiquiti_uap6mp_2']) |
        selectattr('state', 'eq', 'on') | list | count > 0 }}

  action:
    - service: notify.notify
      data_template:
        title: "Unifi Update Available"
        message: >
          {% if states('update.udm_pro') == "on" %}
            {{ state_attr('update.udm_pro', 'friendly_name') }} has an update from {{ state_attr('update.udm_pro', 'installed_version') }} to {{ state_attr('update.udm_pro', 'latest_version') }}
          {% endif %}

          {% if states('update.ubiquiti_uap6mp_1') == "on" %}
            {{ state_attr('update.ubiquiti_uap6mp_1', 'friendly_name') }} has an update from {{ state_attr('update.ubiquiti_uap6mp_1', 'installed_version') }} to {{ state_attr('update.ubiquiti_uap6mp_1', 'latest_version') }}
          {% endif %}

          {% if states('update.ubiquiti_uap6mp_2') == "on" %}
            {{ state_attr('update.ubiquiti_uap6mp_2', 'friendly_name') }} has an update from {{ state_attr('update.ubiquiti_uap6mp_2', 'installed_version') }} to {{ state_attr('update.ubiquiti_uap6mp_2', 'latest_version') }}
          {% endif %}