forked from zacs/ha-nfl
-
Notifications
You must be signed in to change notification settings - Fork 21
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.
- Install the auto-entities custom card if you have not already done so.
- Install the layout-card custom card if you have not already done so.
- Use the sample code below as a base.
- Change
{%- if "sensor.tt_" in team -%}
to pull in the sensor names based on your sensor naming convention (all of mine start w/ "tt_
")- Change
"show_league": true, "entity": team
to include whatever teamtracker-card options you would like.- 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