@kbrown01 i think a simple note of "if you don’t want to use the NFL stuff AND you strip out ALL of the NFL stuff, then you also need to replace the existing game card section of the dashboard.yaml with this;
game_stats:
card:
type: custom:auto-entities
unique: true
show_empty: false
card:
type: custom:layout-card
layout_type: masonry
width: 200px
max-columns: 5
card_param: cards
filter:
template: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
bburwell
(Bob B)
November 23, 2024, 7:06pm
709
@MonsterBandit - Could you test this and see if it bypasses the NFL card better? Assuming you still haven’t added NFL to your config.
I think it is good to have the Redzone code because if anyone adds NFL it’s a cool feature and others may use that code for other creative purposes. I use a similar structure in my NCAAF dashboard to tell me if its a conference vs conference, home game, away game, Top 25 vs Top 25, etc.
If you installed the Sandbox I sent yesterday you can just replace the game_stats section in the decluttering card with this code and let me know. Thanks.
game_stats:
card:
type: custom:auto-entities
unique: true
show_empty: false
card:
type: custom:layout-card
layout_type: masonry
width: 200px
max-columns: 5
card_param: cards
filter:
template: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- if states('sensor.nfl_red_zone') and team in state_attr('sensor.nfl_red_zone', 'teams') -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card {\n\n color: black; \n background-color: #ffcccc; \n box-shadow: 0 0 10px 5px red;\n}\n"},
"home_side": "right"}}},
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
sorry, brotha, just saw this…tested it and it still breaks it
I am going to start messing around and see if i can get a Formula 1 setup going, if you’re interested in assisting
Here are two sensors for Drivers and Constructors standings…not sure if they will work, but i think I got the correct source api, if someone smarter than I can check it.
##
## Formula 1 Drivers Standings
##
- platform: rest
scan_interval: 3600
name: Formula 1 Drivers Standings
unique_id: sensor.f1_drivers_standings
resource: https://site.web.api.espn.com/apis/v2/sports/racing/f1/standings?region=us&lang=en&contentorigin=espn&seasontype=2&group=0&sort=points:desc
value_template: "{{ now() }}"
json_attributes:
- children
##
## Formula 1 Constructors Standings
##
- platform: rest
scan_interval: 3600
name: Formula 1 Constructors Standings
unique_id: sensor.f1_constructors_standings
resource: https://site.web.api.espn.com/apis/v2/sports/racing/f1/standings?region=us&lang=en&contentorigin=espn&seasontype=2&group=1&sort=points:desc
value_template: "{{ now() }}"
json_attributes:
- children
Would love to see if its possible to integrate the custom formula 1 card into this, instead of the teamtracker cards as there really is no “team vs team” so having as much race info as possible would be cool.
Custom Formula One Card
bburwell
(Bob B)
December 6, 2024, 3:35pm
714
Thanks @MonsterBandit - I didn’t know about the constructors or the card - may want to look at it - Was just chasing F1 to see if it led me to other ESPN API’s that hadn’t been documented.
I used a similar structure
###########################
############## Racing
- platform: rest
scan_interval: 36000
name: f1_driver_standings
unique_id: sensor.f1_driver_standings
resource: https://site.web.api.espn.com/apis/v2/sports/racing/f1/standings?seasontype=1&type=0&level=3
value_template: "{{ now() }}"
json_attributes_path: "$.[0]['standings']"
json_attributes:
- entries
- platform: rest
scan_interval: 36000
name: nascar_premier_driver_standings
unique_id: sensor.nascar_premier_driver_standings
resource: https://site.web.api.espn.com/apis/v2/sports/racing/nascar-premier/standings?seasontype=1&type=0&level=3
value_template: "{{ now() }}"
json_attributes_path: "$.[0]['standings']"
json_attributes:
- entries
and was just starting to put together a F1/NASCAR area - here is what I had started but haven’t touched it for a bit.
decluttering_templates:
f1_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 1%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(n+4): 'width: 1%;'
tbody tr td:nth-child(5): 'color: green;'
tbody tr td:nth-child(6): 'color: yellow;'
tbody tr td:nth-child(7): 'color: red;'
tbody tr td:nth-child(10): 'background-color: green; color: white;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr:nth-child(4): 'border-bottom: 2px solid green!important;'
tbody tr:nth-child(5): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(6): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(15): 'border-bottom: 2px solid yellow!important;'
tbody tr:nth-child(16): 'border-bottom: 2px solid crimson!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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Athlete
data: entries
modify: x.athlete.displayName
- name: Championship Points
data: entries
modify: x.stats.find(y=>y.name == 'championshipPts').displayValue
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: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- if team in state_attr('sensor.nfl_red_zone','teams') -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
color: silver;
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
border-width: 2px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Racing
icon: mdi:car-sports
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 15%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
card:
type: custom:tabbed-card
card_mod: null
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 10%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
tabs:
- attributes:
label: Leagues
icon: mdi:football
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 5%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Formula 1 Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
- attributes:
label: NASCAR Premier Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>NASCAR Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: NASCAR Driver Standings
- entity: sensor.nascar_premier_driver_standings
- attribute: entries
Thanks again.
did you get the f1 standings working using the sensor you came up with? I got the api address from ESPN’s site directly (didn’t see anything about “level 3”) but in the address i found (in the developer console of the webpage) in my sensor the “group” section (0 or 1) is the difference between drivers and constructors respectively. not sure if that actually matters or not. where are you getting the address information for your sensor?
@ehcah … got your message, no worries at all. I did see your post, and i don’t think you misunderstood at all. I’m learning and want to try and contribute to this amazing data source and project.
I basically “BS’d” the sensor by using the original rest sensor created (honestly i copied the sensor for one of the NHL ones) and then went to ESPN.com and went to the formula 1 stuff. went to standings and then opened the developer options (F12) and searched for the api information, cleared it out and then toggled between drivers standings and constructors standings and got the two api addresses i put in the the two different sensors i made up. I have absolutely no idea if that is the right thing to do or if you find the api elsewhere. But i wanted to see if someone smarter than I could test them (which you seemingly did and I apparently was on the right track somewhere). I’d like to learn more, and see if i can help get a set up for Formula 1 that can be integrated into this.
Further, i wanted to see if it was possible to utilize that custom formula 1 card (the idea is great) as the card of choice or layout or something, as the card or something, for the area of the tabs for the PRE, IN, POST area (if that makes sense).
I’m just throwing out ideas to see if it sparks an interest or idea with anyone, more or less. If it works, awesome…if not…we figure something else out, ya know?
bburwell
(Bob B)
December 7, 2024, 1:10am
717
I have added the constructor - I have a racing_sensors.yaml that has this:
- platform: rest
scan_interval: 36000
name: f1_driver_standings
unique_id: sensor.f1_driver_standings
resource: https://site.web.api.espn.com/apis/v2/sports/racing/f1/standings?seasontype=1&type=0&level=3
value_template: "{{ now() }}"
json_attributes_path: "$.[0]['standings']"
json_attributes:
- entries
- platform: rest
scan_interval: 36000
name: f1_constructor_standings
unique_id: sensor.f1_constructor_standings
resource: https://site.web.api.espn.com/apis/v2/sports/racing/f1/standings?seasontype=1&type=0&level=3
value_template: "{{ now() }}"
json_attributes_path: "$.[1]['standings']"
json_attributes:
- entries
Still rough but it gives me this:
ooo…i like that…progress in any direction is still…progress…whats the dashboard.yaml look like? Anything in templates.yaml or no?
got it…nm…took out the “League” tab…working on making two tabs for driver’s and constructors. I’m also going to do some digging, because i know theres more info out there that could possibly be added
decluttering_templates:
f1_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 1%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(n+4): 'width: 1%;'
tbody tr td:nth-child(5): 'color: green;'
tbody tr td:nth-child(6): 'color: yellow;'
tbody tr td:nth-child(7): 'color: red;'
tbody tr td:nth-child(10): 'background-color: green; color: white;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr:nth-child(4): 'border-bottom: 2px solid green!important;'
tbody tr:nth-child(5): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(6): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(15): 'border-bottom: 2px solid yellow!important;'
tbody tr:nth-child(16): 'border-bottom: 2px solid crimson!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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Athlete
data: entries
modify: x.athlete.displayName
- name: Championship Points
data: entries
modify: x.stats.find(y=>y.name == 'championshipPts').displayValue
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: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- if team in state_attr('sensor.nfl_red_zone','teams') -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
color: silver;
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
border-width: 2px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Racing
icon: mdi:car-sports
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 15%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
card:
type: custom:tabbed-card
card_mod: null
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 10%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
tabs:
- attributes:
label: Formula 1 Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
- attributes:
label: NASCAR Premier Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>NASCAR Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: NASCAR Driver Standings
- entity: sensor.nascar_premier_driver_standings
- attribute: entries
Ok, so I adjusted things, just a tad…took out “League” and adjusted the tabs, a little for me, but with the idea of this Hierarchy;
Formula 1
- Race Info (maybe?)
- Standings
- Driver's
- Constructors
Figure work on one Racing Series at a time…can always switch the Hierarchy to this when adding more Series;
Racing
- Formula 1
- standings
- race info
- etc
- Nascar
- standings
- race info
- etc
- Other Series
- etc
decluttering_templates:
f1_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 1%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(n+4): 'width: 1%;'
tbody tr td:nth-child(5): 'color: green;'
tbody tr td:nth-child(6): 'color: yellow;'
tbody tr td:nth-child(7): 'color: red;'
tbody tr td:nth-child(10): 'background-color: green; color: white;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr:nth-child(4): 'border-bottom: 2px solid green!important;'
tbody tr:nth-child(5): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(6): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(15): 'border-bottom: 2px solid yellow!important;'
tbody tr:nth-child(16): 'border-bottom: 2px solid crimson!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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Athlete
data: entries
modify: x.athlete.displayName
- name: Championship Points
data: entries
modify: x.stats.find(y=>y.name == 'championshipPts').displayValue
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: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- if team in state_attr('sensor.nfl_red_zone','teams') -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
color: silver;
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
border-width: 2px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Formula 1
icon: mdi:racing-helmet
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 15%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
card:
type: custom:tabbed-card
card_mod: null
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 10%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
tabs:
- attributes:
label: Standings
icon: mdi:ballot
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 5%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Driver
icon: mdi:account
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
- attributes:
label: Constructor
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>Constructor's Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Constructor Standings
- entity: sensor.f1_constructor_standings
- attribute: entries
bburwell
(Bob B)
December 7, 2024, 4:12am
720
No. I have tried to move away completely from Template.yaml. Size restrictions limit the effectiveness.
I really like what the F1 card shows, it looks like the data is grabbed from this site - Race List – Django REST framework and goes back until 1950. Which is crazy.
Here is some of my updated F1 code but I am trying to focus on NCAAF CFP. It has the country, Teams, Colors of teams, etc.
decluttering_templates:
f1_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 1%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(n+4): 'width: 1%;'
tbody tr td:nth-child(5): 'color: green;'
tbody tr td:nth-child(6): 'color: yellow;'
tbody tr td:nth-child(7): 'color: red;'
tbody tr td:nth-child(10): 'background-color: green; color: white;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr:nth-child(4): 'border-bottom: 2px solid green!important;'
tbody tr:nth-child(5): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(6): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(15): 'border-bottom: 2px solid yellow!important;'
tbody tr:nth-child(16): 'border-bottom: 2px solid crimson!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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Country
data: entries
modify: >
(typeof x.athlete.flag !== 'undefined' && typeof x.athlete.flag.alt
!== 'undefined') ? x.athlete.flag.alt : '-'
- name: Driver
data: entries
modify: >-
'<div>' + (typeof x.athlete.flag !== 'undefined' ? '<img src="' +
x.athlete.flag.href + '"
style="width:20px;height:20px;margin-right:5px;">' : '') +
x.athlete.displayName + '</div>'
- name: Championship Points
data: entries
modify: x.stats.find(y=>y.name == 'championshipPts').displayValue
f1_constructor_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 90%;'
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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Team Name
data: entries
modify: >-
'<div style="background-color:#' + x.team.color + ';padding:5px;">'
+ x.team.displayName + '</div>'
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: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- if team in state_attr('sensor.nfl_red_zone','teams') -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
color: silver;
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
border-width: 2px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Racing
icon: mdi:car-sports
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 15%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
card:
type: custom:tabbed-card
card_mod: null
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 10%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
tabs:
- attributes:
label: Leagues
icon: mdi:football
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 5%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Formula 1 Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
- type: custom:decluttering-card
template: f1_constructor_standings
variables:
- title: F1 Constructor Standings
- entity: sensor.f1_constructor_standings
- attribute: entries
- attributes:
label: NASCAR Premier Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>NASCAR Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: NASCAR Driver Standings
- entity: sensor.nascar_premier_driver_standings
- attribute: entries
I’d like to get the code solidified before the season ends so I am ready for next year.
I am just not sure how much data is out there for F1 & NASCAR and I don’t want to create scrapes.
I have kept game stats in there because if I don’t @kbrown01 charges me a licensing fee Honestly the only reason I have it there was I was thinking TeamTracker might pull data at some point and I could use it. I typically copy that code for my sandboxes.
I’ll also add I thought NASCAR was only US but Mexico, Japan, Australia and Columbia are in there. Which is cool.
I’m not big into NASCAR and know absolutely nothing about it, but with F1, season ends tomorrow. However, F1, theres only like a 2.5 month break before car launches and testing middle to end of Feb.
let me see what I can come up with as far as other info, but unfortunately, if you wanted to get into things like throttle or braking trace info or lap times etc. i would almost put money on it would have to be a scrape, but idk for sure
But at least with the Formula races there, F1, F2, F3, F1A, then have things like WRC, WEC, LeMans, GP, GT, GT2, GT3…the list goes on im sure.
@bburwell can you check this sensor and see if it does anything for a schedule?
##
## Formula 1 Schedule
##
- platform: rest
scan_interval: 3600
name: f1_schedule
unique_id: sensor.f1_schedule
resource: https://site.api.espn.com/apis/site/v2/sports/racing/f1/scoreboard?seasontype=2&level=3
value_template: "{{ now() }}"
json_attributes_path: "$.[0]['calendar']"
json_attributes:
- calendar
could be off, but I tried lol
heres the api link for NASCAR too
https://site.api.espn.com/apis/site/v2/sports/racing/nascar-premier/scoreboard
bburwell
(Bob B)
December 9, 2024, 8:54pm
722
There is a calendar section you can get to it here:
- platform: rest
scan_interval: 36000
name: f1_scoreboard
unique_id: sensor.f1_scoreboard
resource: https://site.api.espn.com/apis/site/v2/sports/racing/f1/scoreboard?seasontype=2&level=3
value_template: "{{ now() }}"
json_attributes:
- leagues
You can see the races down in the calendar section:
I have been looking at this website: Api Root View – Django REST framework
- platform: rest
scan_interval: 36000
name: f1_driver_standings_ergast
unique_id: sensor.f1_driver_standings_ergast
resource: https://api.jolpi.ca/ergast/f1/current/driverstandings.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.StandingsTable.StandingsLists[0]"
json_attributes:
- DriverStandings
- platform: rest
scan_interval: 36000
name: f1_races_ergast
unique_id: sensor.f1_races_ergast
resource: https://api.jolpi.ca/ergast/f1/2024/races.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.RaceTable"
json_attributes:
- Races
It seems to provide some additional information but haven’t done too much.
You can see the additional information provided about the races vs ESPN’s.
For right now I don’t expect to do anything else on F1 - Maybe next year - this is all I have right now
could you post the dashboard changes?
bburwell
(Bob B)
December 13, 2024, 12:44am
724
Sure - It includes a NASCAR tab as well. I had added the F1 card (pull it from HACS or load following instructions here - GitHub - marcokreeft87/formulaone-card: Present the data of Formula One in a pretty way ) as well.
Here is what the F1 tab looks like now -
So other place holder data is in there that I haven’t finished up yet. Play, fix, improve, share.
Here is the code:
decluttering_templates:
f1_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 1%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(n+4): 'width: 1%;'
tbody tr td:nth-child(5): 'color: green;'
tbody tr td:nth-child(6): 'color: yellow;'
tbody tr td:nth-child(7): 'color: red;'
tbody tr td:nth-child(10): 'background-color: green; color: white;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr:nth-child(4): 'border-bottom: 2px solid green!important;'
tbody tr:nth-child(5): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(6): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(15): 'border-bottom: 2px solid yellow!important;'
tbody tr:nth-child(16): 'border-bottom: 2px solid crimson!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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Country
data: entries
modify: >
(typeof x.athlete.flag !== 'undefined' && typeof x.athlete.flag.alt
!== 'undefined') ? x.athlete.flag.alt : '-'
- name: Driver
data: entries
modify: >-
'<div>' + (typeof x.athlete.flag !== 'undefined' ? '<img src="' +
x.athlete.flag.href + '"
style="width:20px;height:20px;margin-right:5px;">' : '') +
x.athlete.displayName + '</div>'
- name: Championship Points
data: entries
modify: x.stats.find(y=>y.name == 'championshipPts').displayValue
f1_constructor_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 90%;'
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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Team Name
data: entries
modify: >-
'<div style="background-color:#' + x.team.color + ';padding:5px;">'
+ x.team.displayName + '</div>'
f1_calendar:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 10%;'
tbody tr td:nth-child(2): 'width: 20%;'
tbody tr td:nth-child(3): 'width: 20%;'
tbody tr td:nth-child(4): 'width: 20%;'
tbody tr td:nth-child(5): 'width: 20%;'
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;
}
sort_by:
- Date+
entities:
include: '[[entity]]'
columns:
- name: Date
data: Races
modify: x.date
- name: Race
data: Races
modify: x.Circuit.circuitName
- name: Location
data: Races
modify: >-
'<div>' + x.Circuit.Location.locality + " , " +
x.Circuit.Location.country + '</div>'
f1_standings_ergast:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 10%;'
tbody tr td:nth-child(3+): '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;
}
sort_by:
- MRDatat+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: DriverStandings
modify: x.position
- name: Driver
data: DriverStandings
modify: x.Driver.givenName + ' ' + x.Driver.familyName
- name: Age
data: DriverStandings
modify: >
const birthDate = new Date(x.Driver.dateOfBirth); const today = new
Date(); let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate()))
{ age--; }
age;
- name: Nationality
data: DriverStandings
modify: x.Driver.nationality
- name: Points
data: DriverStandings
modify: x.points
- name: Wins
data: DriverStandings
modify: x.wins
- name: Logo
data: DriverStandings
modify: >-
const constructorLogos = {
red_bull: "https://cdn.racingnews365.com/Teams/Red-Bull/_503xAUTO_crop_center-center_none/f1_2021_redbull_logo.png?v=1643808334",
mercedes: "https://cdn.racingnews365.com/Teams/Mercedes/_503xAUTO_crop_center-center_none/f1_2021_mercedes_logo.png?v=1643808334",
ferrari: "https://cdn.racingnews365.com/Teams/Ferrari/_503xAUTO_crop_center-center_none/f1_2021_ferrari_logo.png?v=1643808334",
mclaren: "https://cdn.racingnews365.com/Teams/McLaren/_503xAUTO_crop_center-center_none/f1_2021_mclaren_logo.png?v=1643808334",
alpine: "https://cdn.racingnews365.com/Teams/Alpine/_503xAUTO_crop_center-center_none/f1_2021_alpine_logo.png?v=1643808334",
aston_martin: "https://cdn.racingnews365.com/Teams/Aston-Martin/_503xAUTO_crop_center-center_none/f1_2021_astonmartin_logo.png?v=1643808334",
williams: "https://cdn.racingnews365.com/Teams/Williams/_503xAUTO_crop_center-center_none/f1_2021_williams_logo.png?v=1643808334",
alfa_romeo: "https://cdn.racingnews365.com/Teams/Alfa-Romeo/_503xAUTO_crop_center-center_none/f1_2021_alfaromeo_logo.png?v=1643808334",
haas: "https://cdn.racingnews365.com/Teams/Haas/_503xAUTO_crop_center-center_none/f1_2021_haas_logo.png?v=1643808334",
alphatauri: "https://cdn.racingnews365.com/Teams/AlphaTauri/_503xAUTO_crop_center-center_none/f1_2021_alphatauri_logo.png?v=1643808334",
sauber: "https://cdn-6.motorsport.com/images/amp/0L17d5W2/s6/logo-stakef1team-rgb-pos-1.jpg",
rb_f1_team: "https://cdn-8.motorsport.com/images/vmt/Dx6zJ6GR/s1/visa-cash-app-rb-logo-unveil-1.jpg",
}; '<div>' + (constructorLogos[x.Constructors[0].constructorId] ?
'<img src="' + constructorLogos[x.Constructors[0].constructorId] +
'" style="width:20px;height:20px;margin-right:5px;">' : '') +
'</div>'
- name: Team
data: DriverStandings
modify: x.Constructors[0].name
- name: Team Nation
data: DriverStandings
modify: x.Constructors[0].nationality
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
color: silver;
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
border-width: 2px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Racing
icon: mdi:car-sports
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 15%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
card:
type: custom:tabbed-card
card_mod: null
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 10%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
tabs:
- attributes:
label: Leagues
icon: mdi:football
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 5%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Formula 1 Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
- type: custom:decluttering-card
template: f1_constructor_standings
variables:
- title: F1 Constructor Standings
- entity: sensor.f1_constructor_standings
- attribute: entries
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings Ergast</h1>
- type: custom:decluttering-card
template: f1_standings_ergast
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings_ergast
- attribute: MRData
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Calendar</h1>
- type: custom:decluttering-card
template: f1_calendar
variables:
- title: F1 Calendar Ergast
- entity: sensor.f1_races_ergast
- attribute: Races
- type: custom:formulaone-card
card_type: results
show_raceinfo: true
- attributes:
label: NASCAR Premier Racing
icon: mdi:account-group
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>NASCAR Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: NASCAR Driver Standings
- entity: sensor.nascar_premier_driver_standings
- attribute: entries
Bro, you are a true hero. I’ll tinker and get back to you. I do want to figure out how to merge the F1 stuff with my existing NHL stuff;
NHL Dash:
decluttering_templates:
nhl_settings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 1600px;'
tbody tr td:first-child: 'width: 2%;'
tbody tr td:nth-child(2): 'width: 20%;'
tbody tr td:nth-child(n+3): 'width: 5%;'
tbody tr:hover: 'background-color: red!important; color:white!important;'
tbody tr td:nth-child(7): 'background-color: red; color: white;'
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]]'
exclude: '[[excluded_entities]]'
sort_by: entries-
columns:
- hidden: true
data: '[[attribute]]'
modify: '[[sort]]'
- name: <div>C</div>
data: '[[attribute]]'
modify: >-
if(typeof x.stats.find(y=>y.abbreviation == 'CLINCH') !==
'undefined' ){x.stats.find(y=>y.abbreviation ==
'CLINCH').displayValue}else{'-'}
- name: Team
data: '[[attribute]]'
modify: >-
'<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.displayName +
'</div>'
- name: <div>GP</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'GP').displayValue
- name: <div>W</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'W').displayValue
- name: <div>L</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'L').displayValue
- name: <div>OTL</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'OTL').displayValue
- name: <div>PTS</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'PTS').displayValue
- name: <div>RW</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'RW').displayValue
- name: <div>ROW</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'ROW').displayValue
- name: <div>SOW</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'SOW').displayValue
- name: <div>SOL</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'SOL').displayValue
- name: <div>HOME</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'HOME').displayValue
- name: <div>AWAY</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'AWAY').displayValue
- name: <div>GF</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'GF').displayValue
- name: <div>GA</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'GA').displayValue
- name: <div>DIFF</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'DIFF').displayValue
- name: <div>L10</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'L10').summary
- name: <div>STRK</div>
data: '[[attribute]]'
modify: x.stats.find(y=>y.abbreviation == 'STRK').displayValue
game_stats:
card:
type: custom:auto-entities
unique: true
show_empty: false
card:
type: custom:layout-card
layout_type: masonry
width: 200px
max-columns: 5
card_param: cards
filter:
template: |
{%- for team in integration_entities("teamtracker") -%}
{%- if state_attr(team, "league") == "[[sport]]" -%}
{%- if states(team) == "[[status]]" -%}
{%- if state_attr(team, "team_homeaway") == "home" -%}
{%- else -%}
{{{"type": "custom:teamtracker-card",
"entity": team,
"home_side": "right"}}},
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
exclude:
- entity_id: '*team_tracker*'
sort:
method: attribute
attribute: date
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: var(--ha-card-background, var(--card-background-color, white) );
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 25%;
}
mwc-tab[active] {
background: #ffcccc !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': red
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: NHL
icon: mdi:hockey-puck
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: var(--ha-card-background, var(--card-background-color, white) );
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: #ffcccc !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': red
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Games
icon: mdi:hockey-sticks
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: var(--ha-card-background, var(--card-background-color, white) );
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 25%;
}
mwc-tab[active] {
background: #ffcccc !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': red
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Pre, Live, Post Games
icon: mdi:hockey-sticks
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>NHL Pre-Games</h1>
- type: custom:decluttering-card
template: game_stats
variables:
- sport: NHL
- status: PRE
- type: markdown
content: |
<h1>NHL Live Games</h1>
- type: custom:decluttering-card
template: game_stats
variables:
- sport: NHL
- status: IN
- type: markdown
content: |
<h1>NHL Post-Games</h1>
- type: custom:decluttering-card
template: game_stats
variables:
- sport: NHL
- status: POST
- attributes:
label: Standings
icon: mdi:ballot
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: var(--ha-card-background, var(--card-background-color, white) );
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 25%;
}
mwc-tab[active] {
background: #ffcccc !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': red
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Division
card:
type: custom:stack-in-card
mode: vertical
cards:
- type: markdown
content: |
<h2>Eastern Conference</h2>
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Metropolitan
- entity: sensor.nhl_east_metropolitan
- attribute: entries
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Atlantic
- entity: sensor.nhl_east_atlantic
- attribute: entries
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: markdown
content: |
<h2>Western Conference</h2>
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Central
- entity: sensor.nhl_west_central
- attribute: entries
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Pacific
- entity: sensor.nhl_west_pacific
- attribute: entries
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- attributes:
label: Conference
card:
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Eastern
- entity: sensor.nhl_east_*
- attribute: entries
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Western
- entity: sensor.nhl_west_*
- attribute: entries
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- attributes:
label: League
card:
type: custom:decluttering-card
template: nhl_settings
variables:
- title: League
- entity: sensor.nhl_*_*
- attribute: entries
- excluded_entities:
- sensor.nhl_starting_goalies
- sensor.nhl_wildcard
- sensor.nhl_wildcard_standings
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- attributes:
label: Wildcard
card:
type: custom:stack-in-card
mode: vertical
cards:
- type: markdown
content: |
<h2>Eastern Conference</h2>
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Metropolitan Leaders
- entity: sensor.nhl_wildcard_standings
- attribute: east_metropolitan_top
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Atlantic Leaders
- entity: sensor.nhl_wildcard_standings
- attribute: east_atlantic_top
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Wildcards
- entity: sensor.nhl_wildcard_standings
- attribute: east_wildcard
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: In The Hunt
- entity: sensor.nhl_wildcard_standings
- attribute: east_hunt
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Eliminated
- entity: sensor.nhl_wildcard_standings
- attribute: east_eliminated
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: markdown
content: |
<h2>Western Conference</h2>
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Central Leaders
- entity: sensor.nhl_wildcard_standings
- attribute: west_central_top
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Pacific Leaders
- entity: sensor.nhl_wildcard_standings
- attribute: west_pacific_top
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Wildcards
- entity: sensor.nhl_wildcard_standings
- attribute: west_wildcard
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: In The Hunt
- entity: sensor.nhl_wildcard_standings
- attribute: west_hunt
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
- type: custom:decluttering-card
template: nhl_settings
variables:
- title: Eliminated
- entity: sensor.nhl_wildcard_standings
- attribute: west_eliminated
- excluded_entities:
- sensor.nhl_starting_goalies
- sort: >-
x.stats.find(y=>y.shortDisplayName ==
'PTS').value
subview: true
title: Sports Standings and Scores
F1 (Basically yours, with minor tweaks) ;
decluttering_templates:
f1_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 1%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(n+4): 'width: 1%;'
tbody tr td:nth-child(5): 'color: green;'
tbody tr td:nth-child(6): 'color: yellow;'
tbody tr td:nth-child(7): 'color: red;'
tbody tr td:nth-child(10): 'background-color: green; color: white;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr:nth-child(4): 'border-bottom: 2px solid green!important;'
tbody tr:nth-child(5): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(6): 'border-bottom: 2px solid dodgerblue!important;'
tbody tr:nth-child(15): 'border-bottom: 2px solid yellow!important;'
tbody tr:nth-child(16): 'border-bottom: 2px solid crimson!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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Country
data: entries
modify: >
(typeof x.athlete.flag !== 'undefined' && typeof x.athlete.flag.alt
!== 'undefined') ? x.athlete.flag.alt : '-'
- name: Driver
data: entries
modify: >-
'<div>' + (typeof x.athlete.flag !== 'undefined' ? '<img src="' +
x.athlete.flag.href + '"
style="width:20px;height:20px;margin-right:5px;">' : '') +
x.athlete.displayName + '</div>'
- name: Championship Points
data: entries
modify: x.stats.find(y=>y.name == 'championshipPts').displayValue
f1_constructor_standings:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 90%;'
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;
}
sort_by:
- entries+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: entries
modify: x.stats.find(y=>y.name == 'rank').displayValue
- name: Team Name
data: entries
modify: >-
'<div style="background-color:#' + x.team.color + ';padding:5px;">'
+ x.team.displayName + '</div>'
f1_calendar:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 10%;'
tbody tr td:nth-child(2): 'width: 20%;'
tbody tr td:nth-child(3): 'width: 20%;'
tbody tr td:nth-child(4): 'width: 20%;'
tbody tr td:nth-child(5): 'width: 20%;'
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;
}
sort_by:
- Date+
entities:
include: '[[entity]]'
columns:
- name: Date
data: Races
modify: x.date
- name: Race
data: Races
modify: x.Circuit.circuitName
- name: Location
data: Races
modify: >-
'<div>' + x.Circuit.Location.locality + " , " +
x.Circuit.Location.country + '</div>'
f1_standings_ergast:
card:
type: custom:flex-table-card
title: '[[title]]'
css:
table+: 'padding: 0px; width: 100%; border-collapse: collapse; margin-top:12px;'
tbody tr td:first-child: 'width: 1%;'
tbody tr td:nth-child(2): 'width: 10%;'
tbody tr td:nth-child(3+): '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;
}
sort_by:
- MRDatat+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: DriverStandings
modify: x.position
- name: Driver
data: DriverStandings
modify: x.Driver.givenName + ' ' + x.Driver.familyName
- name: Age
data: DriverStandings
modify: >
const birthDate = new Date(x.Driver.dateOfBirth); const today = new
Date(); let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate()))
{ age--; }
age;
- name: Nationality
data: DriverStandings
modify: x.Driver.nationality
- name: Points
data: DriverStandings
modify: x.points
- name: Wins
data: DriverStandings
modify: x.wins
- name: Logo
data: DriverStandings
modify: >-
const constructorLogos = {
red_bull: "https://cdn.racingnews365.com/Teams/Red-Bull/_503xAUTO_crop_center-center_none/f1_2021_redbull_logo.png?v=1643808334",
mercedes: "https://cdn.racingnews365.com/Teams/Mercedes/_503xAUTO_crop_center-center_none/f1_2021_mercedes_logo.png?v=1643808334",
ferrari: "https://cdn.racingnews365.com/Teams/Ferrari/_503xAUTO_crop_center-center_none/f1_2021_ferrari_logo.png?v=1643808334",
mclaren: "https://cdn.racingnews365.com/Teams/McLaren/_503xAUTO_crop_center-center_none/f1_2021_mclaren_logo.png?v=1643808334",
alpine: "https://cdn.racingnews365.com/Teams/Alpine/_503xAUTO_crop_center-center_none/f1_2021_alpine_logo.png?v=1643808334",
aston_martin: "https://cdn.racingnews365.com/Teams/Aston-Martin/_503xAUTO_crop_center-center_none/f1_2021_astonmartin_logo.png?v=1643808334",
williams: "https://cdn.racingnews365.com/Teams/Williams/_503xAUTO_crop_center-center_none/f1_2021_williams_logo.png?v=1643808334",
alfa_romeo: "https://cdn.racingnews365.com/Teams/Alfa-Romeo/_503xAUTO_crop_center-center_none/f1_2021_alfaromeo_logo.png?v=1643808334",
haas: "https://cdn.racingnews365.com/Teams/Haas/_503xAUTO_crop_center-center_none/f1_2021_haas_logo.png?v=1643808334",
alphatauri: "https://cdn.racingnews365.com/Teams/AlphaTauri/_503xAUTO_crop_center-center_none/f1_2021_alphatauri_logo.png?v=1643808334",
sauber: "https://cdn-6.motorsport.com/images/amp/0L17d5W2/s6/logo-stakef1team-rgb-pos-1.jpg",
rb_f1_team: "https://cdn-8.motorsport.com/images/vmt/Dx6zJ6GR/s1/visa-cash-app-rb-logo-unveil-1.jpg",
}; '<div>' + (constructorLogos[x.Constructors[0].constructorId] ?
'<img src="' + constructorLogos[x.Constructors[0].constructorId] +
'" style="width:20px;height:20px;margin-right:5px;">' : '') +
'</div>'
- name: Team
data: DriverStandings
modify: x.Constructors[0].name
- name: Team Nation
data: DriverStandings
modify: x.Constructors[0].nationality
views:
- theme: Backend-selected
title: Sports
type: panel
icon: mdi:strategy
badges: []
cards:
- type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
color: silver;
border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
border-width: 2px;
border-style: solid;
overflow: hidden;
width: 20%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Racing
icon: mdi:car-sports
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 15%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
card:
type: custom:tabbed-card
card_mod: null
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 10%;
}
mwc-tab[active] {
background: white !important;
color: black !important
}
tabs:
- attributes:
label: Formula 1
icon: mdi:racing-helmet
card:
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab {
background: black;
border-color: silver;
border-width: 2px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-style: solid;
overflow: hidden;
width: 5%;
}
mwc-tab[active] {
background: white !important;
color: black !important;
}
card:
type: custom:tabbed-card
styles:
'--mdc-theme-primary': black
'--mdc-tab-text-label-color-default': silver
'--mdc-typography-button-font-size': 12px
tabs:
- attributes:
label: Standings
icon: mdi:ballot
card:
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Constructor Standings</h1>
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
- type: custom:decluttering-card
template: f1_constructor_standings
variables:
- title: F1 Constructor Standings
- entity: sensor.f1_constructor_standings
- attribute: entries
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Driver Standings</h1>
- type: custom:decluttering-card
template: f1_standings_ergast
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings_ergast
- attribute: MRData
- attributes:
label: Calendar & Results
icon: mdi:calendar-blank-outline
card:
type: horizontal-stack
cards:
- type: custom:formulaone-card
card_type: countdown
f1_font: true
show_raceinfo: true
hide_racedatetimes: false
- type: vertical-stack
cards:
- type: markdown
content: |
<h1>F1 Calendar</h1>
- type: custom:decluttering-card
template: f1_calendar
variables:
- title: F1 Calendar Ergast
- entity: sensor.f1_races_ergast
- attribute: Races
- type: custom:formulaone-card
card_type: last_result
show_raceinfo: true
The idea would be to have NHL/Racing as the top two tabs, NHL would tree down as the dashboard is already. Racing would tree down as F1, NASCAR, etc then to Calendar and Results, Standings
Thoughts?
Working on an NHL/Formula 1 merge right now. Had a thought, i know its hard to test at the moment, as the season has finished…but do you think there’s a sensor somewhere that might be able to pull live timing information and possibly a track map with live positioning data?
This might be a possibility for data streams, not sure if it would work tho. Check it out…Discord link
Have a merge dashboard ready to go, let me know if you want it, its currently too big to post.
bburwell
(Bob B)
December 24, 2024, 6:50pm
728
As far as combining them yeah just adjust the tab attributes and code accordingly. My guidance would be to create a new dashboard and then copy the decluttering and nhl tabs over to the new dashboard. Clean up and then add F1 piecemeal. That way you don’t mess up your original card and only add the items you want.
Haven’t looked at F1 but a couple items: there is a chat about the F1 Card over at Formula One Card
and @newneo discusses it on this link:
Looking forward to seeing what you create.