Skip to content

Using Auto Entities Card to Hide NOT_FOUND Status

David edited this page Feb 18, 2023 · 1 revision

An alternative way to hide cards with a status of NOT_FOUND is to use the auto-entities and layout-card with a template filter.

  1. Install the auto-entities custom card if you have not already done so.
  2. Install the layout-card custom card if you have not already done so.
  3. Use the sample code below as a base.
  1. Change {%- if "sensor.tt_" in team -%} to pull in the sensor names based on your sensor naming convention (all of mine start w/ "tt_")
  2. Change "show_league": true, "entity": team to include whatever teamtracker-card options you would like.
  3. You can also change or add additional conditions to {%- if not is_state(team, "NOT_FOUND") -%} to filter based on any attribute by using state_attr() instead of or in addtion to is_state(). Example: {%- if state_attr(team, "team_homeaway") == "home" -%}
type: custom:auto-entities
unique: true
show_empty: false
card:
  type: custom:layout-card
  layout_type: masonry
card_param: cards
filter:
  template: |
    {%- for team in integration_entities("teamtracker") -%}
       {%- if "sensor.tt_" in team -%}
            {%- if not is_state(team, "NOT_FOUND") -%}
                {{{"type": "custom:teamtracker-card",
                   "show_league": true,
                   "entity": team }}},
            {%- endif -%}
        {%- endif -%}
    {%- endfor -%}
sort:
  method: attribute
  attribute: date