Dynamically load a card - ideas needed

I have an alert list and when I click on the alert it brings up an alert details display. I use the auto-entities card in YAML displays and this works fine. Code below

What I’d like to do is show alert details based on the type of alert. Examples of types are device offline, temperature exceeds limit, network ping fails, voltage out of range. Each of these types has specific information that I’d want to show. I could extract the “type” from the entity_id or put into an attribute.

What I’d really like to do is use lovelace_gen to parse the hash and then !include the right card YAML as I’ve modularized the dashboard config using lovelace_gen to include cards and views. But AFAIK lovelace_gen doesn’t have the hash…

All ideas :pray:

  - type: conditional
    conditions:
      - entity: sensor.alert_total_count
        state_not: "0"
    card:
      type: custom:auto-entities
      card:
        type: entity-filter
        show_empty: true
        state_filter:
          - "on"
          - "off"
        card:
          type: entities
          title: Alerts
          state_color: true
          theme: alert_red
      filter:
        include:
          - entity_id: "alert.*"
            options:
              tap_action:
                action: navigate
                navigation_path: "/lovelace-alerts/alert_details#this.entity_id"

Details display

  - path: alert_details
    panel: true
    title: Details
    subview: true
    cards:
      - type: vertical-stack
        cards:
          - type: custom:auto-entities
            card:
              type: entities
              state_color: true
            filter:
              template: |
                {% set suffix = hash.split(".")[1] %}
                alert.{{suffix}},
                binary_sensor.{{suffix}}_alert,
                input_boolean.{{suffix}}_alert_enable,
          - type: custom:auto-entities
            card:
              type: history-graph
              hours_to_show: 48
            filter:
              template: |
                {% set suffix = hash.split(".")[1] %}
                alert.{{suffix}},