Ok I got it working but I probably need to clean this up but I followed @kbrown01 's advice.
In my template.yaml file I created a sensor that pulls out the team names and sticks them in the sensor.
########
##NCAA Football Teams
#### Big 12
- name: ncaaf_team_names_big_12
unique_id: sensor.ncaaf_team_names_big_12
state: "{{ now() }}"
attributes:
team_names: >
{% set cteams = namespace(cteam=[]) %}
{% for team in state_attr('sensor.college_football_standings', 'children')[2]['standings']['entries'] %}
{% set cteams.cteam = cteams.cteam + [team['team']['abbreviation']] %}
{% endfor %}
{{ cteams.cteam | join(', ') }}
I then pass both the group and team names to the template like this:
- attributes:
label: Big 12 Conference
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: custom:decluttering-card
template: ncaa_conference_settings
variables:
- title: NCAA Big 12 Conference
- entity: sensor.ncaaf_big_12_games
- attribute: events
- type: markdown
content: |
<h1>Big 12 conference</h1>
- type: custom:decluttering-card
template: ncaaf_conference_game_stats
variables:
- group: group.big_12_conference_teams_group
- team_names: sensor.ncaaf_team_names_big_12
I then updated the template to include all home games from the group and then go through the away teams and see if the home team is a big 12 team, if not print the card.
ncaaf_conference_game_stats:
card:
type: custom:auto-entities
unique: true
show_empty: false
card:
type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))
card_param: cards
filter:
template: >
{% set team_names = state_attr('[[team_names]]',
'team_names').split(', ') %} {%- for team in
state_attr('[[group]]','entity_id') %}
{%- if state_attr(team, "team_homeaway") == "home" and state_attr(team, "opponent_abbr") in team_names-%}
{{{"type": "custom:teamtracker-card","entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px; border: 2px solid blue; background-color: rgba(224, 247, 250, 0.1); }"},
"home_side": "right",}}},
{%- elif state_attr(team, "team_homeaway") == "home" -%}
{{{"type": "custom:teamtracker-card","entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right",}}},
{%- elif state_attr(team, "team_homeaway") != "home" and state_attr(team, "opponent_abbr") not in team_names -%}
{{{"type": "custom:teamtracker-card","entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right",}}},
{%- endif -%}
{%- endfor %}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
Took @kbrown01 idea of the red zone card customization and applied it to in-conference games.
Before image:
After:
Thanks @kbrown01 for pointing me in the right direction. Any recommendations on cleaning this up are always welcome.
Eventually I will add tabs for the other conferences and then just pass the 2 sensors to the template.