This will likely get me laughed off this page as there is nothing eloquent or clean about it.
ncaafranking_settings:
card:
type: custom:flex-table-card
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: .5%;'
tbody tr td:nth-child(2): 'width: 5%;'
tbody tr td:nth-child(n+3): 'width: 2%;'
tbody tr td:nth-child(7): 'width: 5%;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
card_mod:
style:
.: |
ha-card {
overflow: auto;
}
$: |
.card-header {
padding-top: 6px!important;
padding-bottom: 4px!important;
font-size: 14px!important;
line-height: 14px!important;
font-weight: bold!important;
}
entities:
include: '[[entity]]'
sort_by: entries-
columns:
- hidden: true
data: '[[attribute]]'
- name: <div style="height:20px;text-indent:5px;">RANK</div>
data: '[[attribute]]'
modify: >-
if (typeof x !== 'undefined' && typeof x.current !== 'undefined') {
x.current;
} else {
'';
}
if (typeof x !== 'undefined' && typeof x.current !== 'undefined' &&
typeof x.current !== 'undefined') {
'<div style="font-weight:normal;text-indent:10px;">' + x.current + '</div>';
} else {
'';
}
- name: <div>TEAM</div>
data: '[[attribute]]'
modify: |-
if (typeof x.team.links !== 'undefined')
'<div> <a href="' + x.team.links[0].href +
'" target="_blank"><img src="' + x.team.logos[0].href +
'" style="height:20px;vertical-align:middle;"></a> ' +
x.team.nickname + ' ' + x.team.name + '</div>';
else
'<div>' + x.team.nickname + ' ' + x.team.name + '</div>'
- name: <div style="text-align:center;">TREND</div>
data: '[[attribute]]'
modify: >-
if (typeof x !== 'undefined' && typeof x.current !== 'undefined' &&
typeof x.previous !== 'undefined') {
let content = '';
let icon = '';
let text = '';
if (x.current === x.previous) {
icon = '<ha-icon icon="mdi:minus" style="fill:white;"></ha-icon>';
} else if (x.previous === 0) {
text = '<div style="font-size:14px;color:white;">NR</div>';
} else {
let difference = x.current - x.previous;
if (difference > 0) {
icon = '<ha-icon icon="mdi:arrow-down" style="color:red;"></ha-icon>';
text = '<div style="font-size:14px;color:red;">' + difference + '</div>';
} else if (difference < 0) {
icon = '<ha-icon icon="mdi:arrow-up" style="color:green;"></ha-icon>';
text = '<div style="font-size:14px;color:green;">' + Math.abs(difference) + '</div>';
}
}
content = '<div style="display:flex;align-items:center;justify-content:center;width:100%;height:100%;">' +
icon +
(icon && text ? '<div style="margin-left:5px;">' + text + '</div>' : text) +
'</div>';
content;
} else {
'';
}
- name: <div style="height:20px;text-indent:5px;">W-L</div>
data: '[[attribute]]'
modify: |-
if (typeof x.recordSummary !== 'undefined') {
'<div style="font-weight:normal;text-indent:10px;">' + x.recordSummary + '</div>';
} else {
'';
}
- name: <div style="height:20px;text-indent:5px;">POINTS</div>
data: '[[attribute]]'
modify: |-
if (typeof x.points !== 'undefined') {
var formattedPoints = new Intl.NumberFormat().format(x.points);
'<div style="font-weight:normal;text-indent:10px;">' + formattedPoints + '</div>';
} else {
'';
}
- name: <div style="height:20px;text-indent:5px;">VOTES</div>
data: '[[attribute]]'
modify: >-
// Check if the data exists and return it, otherwise return an empty
string
if (typeof x.firstPlaceVotes !== 'undefined' && x.firstPlaceVotes
!== 0) {
'<div style="font-weight:normal;text-indent:10px;">' + x.firstPlaceVotes + '</div>';
} else {
'';
}
- name: <div style="height:20px;text-indent:5px;">TEAM PAGE</div>
data: '[[attribute]]'
modify: >-
if (typeof x.team.links !== 'undefined' && x.team.links.length > 0)
{
'<div><a href="' + x.team.links[0].href +
'" target="_blank" style="text-decoration:none;color:white;">' +
'<div style="font-weight:normal;text-indent:10px;">' +
x.team.nickname + ' ' + x.team.name + ' (' + x.team.abbreviation + ') ' +
'</div></a></div>';
} else {
'<div>' + x.team.nickname + ' ' + x.team.name + '</div>';
}
To get the Week number I created 2 sensors. I’m only display the Week on that dashboard but you could also add the date range for it.
- platform: template
scan_interval: 86400
sensors:
current_status:
friendly_name: "College Football Week Number"
unique_id: sensor.college_football_week_number
value_template: >
{% set today = now().date() %}
{% set date_format = '%Y-%m-%d' %}
{% set date_ranges = [
{'start': '2024-01-10', 'end': '2024-08-23', 'status': 'OFF-SEASON', 'range': 'JAN 10 - AUG 23'},
{'start': '2024-08-24', 'end': '2024-09-02', 'status': 'WEEK 1', 'range': 'Aug 24 - SEP 2'},
{'start': '2024-09-03', 'end': '2024-09-07', 'status': 'WEEK 2', 'range': 'SEP 3 - 7'},
{'start': '2024-09-08', 'end': '2024-09-14', 'status': 'WEEK 3', 'range': 'SEP 8 - 14'},
{'start': '2024-09-15', 'end': '2024-09-21', 'status': 'WEEK 4', 'range': 'SEP 15 - 21'},
{'start': '2024-09-22', 'end': '2024-09-28', 'status': 'WEEK 5', 'range': 'SEP 22 - 28'},
{'start': '2024-09-29', 'end': '2024-10-05', 'status': 'WEEK 6', 'range': 'SEP 29 - OCT 5'},
{'start': '2024-10-06', 'end': '2024-10-12', 'status': 'WEEK 7', 'range': 'OCT 6 - 12'},
{'start': '2024-10-13', 'end': '2024-10-19', 'status': 'WEEK 8', 'range': 'OCT 13 - 19'},
{'start': '2024-10-20', 'end': '2024-10-26', 'status': 'WEEK 9', 'range': 'OCT 20 - 26'},
{'start': '2024-10-27', 'end': '2024-11-02', 'status': 'WEEK 10', 'range': 'OCT 27 - NOV 2'},
{'start': '2024-11-03', 'end': '2024-11-09', 'status': 'WEEK 11', 'range': 'NOV 3 - 9'},
{'start': '2024-11-10', 'end': '2024-11-16', 'status': 'WEEK 12', 'range': 'NOV 10 - 16'},
{'start': '2024-11-17', 'end': '2024-11-23', 'status': 'WEEK 13', 'range': 'NOV 17 - 23'},
{'start': '2024-11-24', 'end': '2024-11-30', 'status': 'WEEK 14', 'range': 'NOV 24 - 30'},
{'start': '2024-12-01', 'end': '2024-12-07', 'status': 'WEEK 15', 'range': 'DEC 1 - 7'},
{'start': '2024-12-08', 'end': '2024-12-13', 'status': 'WEEK 16', 'range': 'DEc 8 - 14'},
{'start': '2024-12-14', 'end': '2025-01-21', 'status': 'BOWLS', 'range': 'DEC 14 - JAN 21'},
{'start': '2025-01-22', 'end': '2025-08-22', 'status': 'OFF-SEASON', 'range': 'JAN 22 - AUG 22'}
] %}
{% for date_range in date_ranges %}
{% set start_date = strptime(date_range.start, date_format).date() %}
{% set end_date = strptime(date_range.end, date_format).date() %}
{% if today >= start_date and today <= end_date %}
{{ date_range.status }}
{% endif %}
{% endfor %}
current_range:
friendly_name: "College Football Week Dates"
unique_id: sensor.college_football_week_dates
value_template: >
{% set today = now().date() %}
{% set date_format = '%Y-%m-%d' %}
{% set date_ranges = [
{'start': '2024-01-10', 'end': '2024-08-23', 'status': 'OFF-SEASON', 'range': 'JAN 10 - AUG 23'},
{'start': '2024-08-24', 'end': '2024-09-02', 'status': 'WEEK 1', 'range': 'Aug 24 - SEP 2'},
{'start': '2024-09-03', 'end': '2024-09-07', 'status': 'WEEK 2', 'range': 'SEP 3 - 7'},
{'start': '2024-09-08', 'end': '2024-09-14', 'status': 'WEEK 3', 'range': 'SEP 8 - 14'},
{'start': '2024-09-15', 'end': '2024-09-21', 'status': 'WEEK 4', 'range': 'SEP 15 - 21'},
{'start': '2024-09-22', 'end': '2024-09-28', 'status': 'WEEK 5', 'range': 'SEP 22 - 28'},
{'start': '2024-09-29', 'end': '2024-10-05', 'status': 'WEEK 6', 'range': 'SEP 29 - OCT 5'},
{'start': '2024-10-06', 'end': '2024-10-12', 'status': 'WEEK 7', 'range': 'OCT 6 - 12'},
{'start': '2024-10-13', 'end': '2024-10-19', 'status': 'WEEK 8', 'range': 'OCT 13 - 19'},
{'start': '2024-10-20', 'end': '2024-10-26', 'status': 'WEEK 9', 'range': 'OCT 20 - 26'},
{'start': '2024-10-27', 'end': '2024-11-02', 'status': 'WEEK 10', 'range': 'OCT 27 - NOV 2'},
{'start': '2024-11-03', 'end': '2024-11-09', 'status': 'WEEK 11', 'range': 'NOV 3 - 9'},
{'start': '2024-11-10', 'end': '2024-11-16', 'status': 'WEEK 12', 'range': 'NOV 10 - 16'},
{'start': '2024-11-17', 'end': '2024-11-23', 'status': 'WEEK 13', 'range': 'NOV 17 - 23'},
{'start': '2024-11-24', 'end': '2024-11-30', 'status': 'WEEK 14', 'range': 'NOV 24 - 30'},
{'start': '2024-12-01', 'end': '2024-12-07', 'status': 'WEEK 15', 'range': 'DEC 1 - 7'},
{'start': '2024-12-08', 'end': '2024-12-13', 'status': 'WEEK 16', 'range': 'DEc 8 - 14'},
{'start': '2024-12-14', 'end': '2025-01-21', 'status': 'BOWLS', 'range': 'DEC 14 - JAN 21'},
{'start': '2025-01-22', 'end': '2025-08-22', 'status': 'OFF-SEASON', 'range': 'JAN 22 - AUG 22'}
] %}
{% for date_range in date_ranges %}
{% set start_date = strptime(date_range.start, date_format).date() %}
{% set end_date = strptime(date_range.end, date_format).date() %}
{% if today >= start_date and today <= end_date %}
{{ date_range.range }}
{% endif %}
{% endfor %}
And…
- attributes:
label: RANKINGS
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: >
<h1>TOP 25 AP POLL</h1>
<h3>{{ states('sensor.college_football_week_number') }}</h3>
- type: custom:decluttering-card
template: ncaafranking_settings
variables:
- title: AP Top 25 Poll
- entity: sensor.college_football_ap_poll
- attribute: entries
- type: vertical-stack
cards:
- type: markdown
content: >
<h1>AFCA COACHES POLL</h1>
<h3>{{ states('sensor.college_football_week_number') }}</h3>
- type: custom:decluttering-card
template: ncaafranking_settings
variables:
- title: AFCA Coaches Poll
- entity: sensor.college_football_afca_coaches_poll
- attribute: entries