any reason this sensor isnt working that im missing?
##
## Formula 1 Constructors Standings
##
- platform: rest
scan_interval: 36000
name: f1_constructor_standings
unique_id: sensor.f1_constructor_standings
resource: https://api.jolpi.ca/ergast/f1/current/constructorstandings.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.StandingsTable.StandingsLists[0]"
json_attributes:
- ConstructorStandings
bburwell
(Bob B)
December 25, 2024, 12:40am
730
Nothing stands out. Do you have duplicate f1_constructor_standings? I renamed yours because I had a f1_constructor_standings sensor other than that looks good - I used this:
##
## Formula 1 Constructors Standings ehcah
##
- platform: rest
scan_interval: 36000
name: f1_constructor_standings_ehcah
unique_id: sensor.f1_constructor_standings_ehcah
resource: https://api.jolpi.ca/ergast/f1/current/constructorstandings.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.StandingsTable.StandingsLists[0]"
json_attributes:
- ConstructorStandings
And this is what I am showing:
kbrown01
(Kbrown01)
December 25, 2024, 12:44am
731
Works perfect for me.
what exactly is not working?
displays nothing when loaded into the dashboard
even tried copying the same âlayoutâ from the driverâs standing cardâŚnothing
Hereâs my combined F1/NHL dash
kbrown01
(Kbrown01)
December 25, 2024, 2:45am
733
Start with data please. Do you actually get any data like above?
This looks wrong:
- type: custom:decluttering-card
template: f1_standings
variables:
- title: F1 Driver Standings
- entity: sensor.f1_driver_standings
- attribute: entries
Ainât no attribute âentriesâ ⌠maybe âConstrutorStandingsâ but way too much to diagnose. Set up a simple example
yes, i get the data, just no output
kbrown01
(Kbrown01)
December 25, 2024, 2:55am
735
You use:
json_attributes:
- ConstructorStandings
where does âentriesâ come from or are you merely copying from NHL?
was working off of what @bburwell had put together. tweaking that and seeing what i could come up with. âentriesâ comes from the espn api sensor, that has since been changed to the ergast sensor. I adjusted the attribute on the sensor, but not in the dash code
bburwell
(Bob B)
December 25, 2024, 3:12am
737
When I copy your code and put it into a new/blank dashboard I am seeing data - see below. I have not altered your code, I am using Kbrownâs NHL sensors and I am using the F1/NASCAR sensors I posted in this thread above.
To kbrownâs point - what are you seeing on your dashboard? Are you seeing NHL Data and not F1 or are you not seeing either?
This is what I am seeing.
kbrown01
(Kbrown01)
December 25, 2024, 3:13am
738
Well it is totally unclear, none of you have would work.
âentriesâ exists as that is in the sensor for other sports.
It is repeating element for rows.
Yours is not âentriesâ.
Then you are trying to get children to that like
x.stats.find(y=>y.name == 'rank').displayValue
ârankâ does not exist.
so you re trying to iterate over nothing and get nothing ⌠so it returns nothing. You need to study in depth how things are wrapped together, you cannot just paste things in. It took months to standardize all those for NHL, MLB, NFL, NBA ⌠others are will not just work the same.
just the Constructorâs standings infoâŚeverything else is functioning correctlyâŚits the constructors standings info that isnât generating any output on the dashboard.
got ya. Iâll continue to tinker with it.
bburwell
(Bob B)
December 25, 2024, 3:28am
741
Well my ESPN Constructor does have entries but MonsterBandit your constructor has ConstructorStandings. So the attribute you are passing needs to be ConstructorStandings
- 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
Your Constructor would need to pass ConstructorStandings and the layout is different from the ESPN Constructor that I grab. So you would need to create a decluttering template for that data or you would need to just put the data into a Flex-Table card. The Constructor data I have on the card comes from ESPN
This is what my F1 looks like right now - but I havenât touched (and need to clean up) in a while
bburwell
(Bob B)
December 25, 2024, 3:58am
742
Monster - the items that you are looking for arenât in your ConstructorStandings sensor.
I changed the sensor so this is the rest sensor I am calling so it doesnât overlap with my ESPN sensor:
- platform: rest
scan_interval: 36000
name: f1_constructor_standings_monsterbandit
unique_id: sensor.f1_constructor_standings_monsterbandit
resource: https://api.jolpi.ca/ergast/f1/current/constructorstandings.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.StandingsTable.StandingsLists[0]"
json_attributes:
- ConstructorStandings
In that sensor you see it doesnât have things like team color, so you canât have those in your decluttering template it wont show anything:
So here is something you can build off:
Decluttering:
f1_constructor_standings_monster:
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:
- ConstructorStandings+
entities:
include: '[[entity]]'
columns:
- name: Rank
data: ConstructorStandings
modify: x.position
- name: Team Name
data: ConstructorStandings
modify: x.Constructor.constructorId
And to call it here is something that you can start with:
- type: custom:decluttering-card
template: f1_constructor_standings_monster
variables:
- title: F1 Constructor Standings
- entity: >-
sensor.f1_constructor_standings_monsterbandit
- attribute: ConstructorStandings
This is all that is displaying with this code but you can build on it. The new code shows up at the bottom of the screen shot - the top is using the ESPN API and decluttering card I posted before
Got it working with the ergast sensorâŚ
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: 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: ConstructorStandings
modify: x.position
- name: Logo
data: ConstructorStandings
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.Constructor.constructorId] ? '<img
src="' + constructorLogos[x.Constructor.constructorId] + '"
style="width:20px;height:20px;margin-right:5px;">' : '') + '</div>'
- name: Constructor
data: ConstructorStandings
modify: x.Constructor.name
- name: Nationality
data: ConstructorStandings
modify: x.Constructor.nationality
- name: Points
data: ConstructorStandings
modify: x.points
- name: Wins
data: ConstructorStandings
modify: x.wins
Or just use Formula One card
i think i standardized it a little, not sure if there is anything can be done to âcompressâ the code to make it smaller (beyond my depth). But using the jolpi.ca api i have it working and looking close to the other sports. im hopeful the jolpi.ca will pick up other series, but until that happens, idk. I canât find a public api to use for any other series. Would you like help looking at NASCAR via espn?
Dashboard;
decluttering_templates:
f1_driver_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: 2%;'
tbody tr td:nth-child(2): 'width: 3%;'
tbody tr td:nth-child(3): 'width: 3%;'
tbody tr td:nth-child(4): 'width: 20%;'
tbody tr td:nth-child(5): 'width: 3%;'
tbody tr td:nth-child(6): 'width: 15%;'
tbody tr:hover: 'background-color: dimgrey!important; color:white!important;'
tbody tr td:nth-child(7): 'background-color: red; color: white; width: 5%;'
tbody tr td:nth-child(8): 'width: 15%;'
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: 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: Number
data: DriverStandings
modify: x.Driver.permanentNumber
- 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: Team
data: DriverStandings
modify: x.Constructors[0].name
- name: Wins
data: DriverStandings
modify: x.wins
- name: Team Nation
data: DriverStandings
modify: x.Constructors[0].nationality
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: 2%;'
tbody tr td:nth-child(2): 'width: 6%;'
tbody tr td:nth-child(3): 'width: 20%;'
tbody tr td:nth-child(4): 'background-color: red; color: white; width: 5%;'
tbody tr td:nth-child(5): 'width: 10%;'
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: ConstructorStandings
modify: x.position
- name: Logo
data: ConstructorStandings
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.Constructor.constructorId] ? '<img
src="' + constructorLogos[x.Constructor.constructorId] + '"
style="width:20px;height:20px;margin-right:5px;">' : '') + '</div>'
- name: Constructor
data: ConstructorStandings
modify: x.Constructor.name
- name: Points
data: ConstructorStandings
modify: x.points
- name: Nationality
data: ConstructorStandings
modify: x.Constructor.nationality
- name: Wins
data: ConstructorStandings
modify: x.wins
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: Race
data: Races
modify: x.raceName
- name: Date
data: Races
modify: x.date
- name: Time
data: Races
modify: x.time
- name: Curcuit
data: Races
modify: x.Circuit.circuitName
- name: Location
data: Races
modify: >-
'<div>' + x.Circuit.Location.locality + " , " +
x.Circuit.Location.country + '</div>'
Sensors;
##
## Formula 1 Drivers Standings
##
- platform: rest
scan_interval: 3600
name: f1_driver_standings
unique_id: sensor.f1_driver_standings
resource: https://api.jolpi.ca/ergast/f1/current/driverstandings.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.StandingsTable.StandingsLists[0]"
json_attributes:
- DriverStandings
##
## Formula 1 Constructors Standings
##
- platform: rest
scan_interval: 3600
name: f1_constructor_standings
unique_id: sensor.f1_constructor_standings
resource: https://api.jolpi.ca/ergast/f1/current/constructorstandings.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.StandingsTable.StandingsLists[0]"
json_attributes:
- ConstructorStandings
##
## Formula 1 Schedule
##
- platform: rest
scan_interval: 3600
name: f1_races
unique_id: sensor.f1_races
resource: https://api.jolpi.ca/ergast/f1/current/races.json
value_template: "{{ now() }}"
json_attributes_path: "$.MRData.RaceTable"
json_attributes:
- Races
I already do buddy lol (even have it integrated into this too)
1 Like
Did anyone ever get the NFL, MLB, or NBA playoff pages filled out?
kbrown01
(Kbrown01)
January 9, 2025, 8:02pm
748
Can you define filled out?