Might be a caching issue of some sort. “Last Race” on my mobile app still shows Abu Dhabi last season, whilst on my desktop it shows yesterday’s race. All other cards have updated, both on mobile app as desktop.
The results from the API are cached. Depending on what kind of data is requested from the API, it will cache 1,3 or 24 hours. Thats because, otherwise the API will block your IP address
Yes, working on that
you’re awesome
SHould be fixed in new release. Can’t be 100 % sure ofcourse till the next race
Hello, I create an account as you say on Visual Crossing Weather but it’s confused how API works. They need a specific location if I understant correctly, but what location must i use? My country, a random one or F1 schedule coutries?
You just need the api key
Log in, go to your account and there is your key. That’s all.
The api for getting the countries was down… But its back up again now!
awesome, it works. many thanks. thanks for your support.
@marcokreeft87 would it be possible to style it like this with the frontend card?
now it’s not working, because the formulaOne Api is not supported anymore.
here is my yaml code
there are two drivers in it from the last season
VER and LEC
on top you will find the header with
“Pos”, “Driver”, “Pts”, “Win”
if this would be possible, I can also send you the yaml code for the constructors.
drivers preview
constructor preview
yaml code for drivers
hardcoded without api values
- theme: Backend-selected
title: Drivers
path: drivers
icon: mdi:racing-helmet
badges: []
cards:
- type: vertical-stack
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: auto 33px
margin: '-4px -4px -16px -4px'
padding: 0px
border: 0px
cards:
- type: custom:mod-card
card:
type: custom:mushroom-title-card
title: null
subtitle: Driver Standings
card_mod:
style:
mushroom-title-card:
$: |
h1 {
--primary-text-color: rgb(var(--rgb-grey));
--title-font-size: 15px;
--title-font-weight: bolder;
}
h2 {
--secondary-text-color: white;
--subtitle-font-size: 20px;
font-family: "Formula1-bold";
padding-bottom: 10px;
}
.header {
--title-padding: 4px 0px 4px 4px;
}
- type: custom:mod-card
card:
type: custom:layout-card
layout_type: masonry
layout:
margin: 0 -1px -8px -1px
padding: 0px
cards:
- type: custom:stack-in-card
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 55px auto 58px 55px
margin: '-6px -6px -6px -6px'
cards:
- type: custom:mushroom-template-card
primary: 'Pos'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-regular";
--card-primary-font-size: 7px;
margin-left: 4px;
border: 0;
text-align: center;
}
- type: custom:mushroom-template-card
primary: 'Driver'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 7px;
margin-left: 4px;
border: 0;
}
- type: custom:mushroom-template-card
primary: 'Pts'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 7px;
margin-left: 0px;
border: 0;
text-align: center;
}
- type: custom:mushroom-template-card
primary: 'Win'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 7px;
margin-left: 0px;
border: 0;
text-align: center;
}
card_mod:
style: |
ha-card {
border: 0;
}
- type: custom:stack-in-card
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 55px auto 58px 55px
margin: '-6px -6px -6px -6px'
padding: 0px
border: 0px
cards:
- type: custom:mushroom-template-card
primary: '1'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-regular";
--card-primary-font-size: 9px;
margin-left: 4px;
margin-top: 12px;
border: 0;
text-align: center;
}
- type: custom:mushroom-template-card
primary: Max Verstappen
secondary: Red Bull
picture: /local/formula1/driver/VER.png
tap_action: none
card_mod:
style:
mushroom-shape-avatar$: |
.picture {
height: auto !important;
}
.: |
ha-card {
font-family: "Formula1-bold";
--card-primary-font-size: 11px;
--card-secondary-font-size: 10px;
margin-left: -8px;
margin-top: -4px;
border: 0;
}
- type: custom:mushroom-template-card
primary: '454'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 9px;
margin-top: 12px;
border: 0;
text-align: center;
}
- type: custom:mushroom-template-card
primary: '15'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 9px;
margin-top: 12px;
border: 0;
text-align: center;
}
card_mod:
style: |
ha-card {
border: 0;
height: 55px;
}
- type: custom:stack-in-card
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 55px auto 58px 55px
margin: '-6px -6px -6px -6px'
padding: 0px
border: 0px
cards:
- type: custom:mushroom-template-card
primary: '2'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-regular";
--card-primary-font-size: 9px;
margin-left: 4px;
margin-top: 12px;
border: 0;
text-align: center;
}
- type: custom:mushroom-template-card
primary: Charles Leclerc
secondary: Ferrari
picture: /local/formula1/driver/LEC.png
tap_action: none
card_mod:
style:
mushroom-shape-avatar$: |
.picture {
height: auto !important;
}
.: |
ha-card {
font-family: "Formula1-bold";
--card-primary-font-size: 11px;
--card-secondary-font-size: 10px;
margin-left: -8px;
margin-top: -4px;
border: 0;
}
- type: custom:mushroom-template-card
primary: '308'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 9px;
margin-top: 12px;
border: 0;
text-align: center;
}
- type: custom:mushroom-template-card
primary: '15'
tap_action: none
card_mod:
style: |
ha-card {
font-family: "Formula1-Regular";
--card-primary-font-size: 9px;
margin-top: 12px;
border: 0;
text-align: center;
}
card_mod:
style: |
ha-card {
border: 0;
height: 55px;
}
That would require too much changes, plus local images make the whole package too big and too much maintainance on my part. You could try and use the sensor template I posted in here. That gives you the same data and in the same format
do you mean this one?
is there a documentation how I can access the drivers and constructors?
- platform: rest
scan_interval: 86400
resource_template: https://ergast.com/api/f1/{{ now().strftime('%Y') }}.json
sensor:
- name: "F1 Schedule"
json_attributes_path: "$.MRData"
value_template: "OK"
json_attributes:
- "total"
- "RaceTable"
thanks marco
it‘s working now with the rest api
pictures and logos are from the f1 page
this was the part in the “configuration.yaml”
rest:
- scan_interval: 43200
resource_template: https://ergast.com/api/f1/current/driverStandings.json
sensor:
- name: "F1 Drivers"
json_attributes_path: "$.MRData"
value_template: "OK"
json_attributes:
- "total"
- "StandingsTable"
- scan_interval: 43200
resource_template: https://ergast.com/api/f1/current/constructorStandings.json
sensor:
- name: "F1 Constructors"
json_attributes_path: "$.MRData"
value_template: "OK"
json_attributes:
- "total"
- "StandingsTable"
constructors
drivers
Looks good…any chance you’d share the final code for the two cards?
sure!
but it’s a bit complicated and you have to be an advanced yaml coder or a developer.
please note: in my dashboard there will be only 20 drivers, if a testdriver is going to drive in this season, he will not appear after the 20th driver.
you need to install these frontend modules in HACS
- mod-card
- mushroom-title-card
- stack-in-card
- mushroom-template-card
- layout-card
- grid-layout
then you have to store all images into your HA
and save it into:
File Editor > www
create this folder in “www”
- “formula1”
download link for logos and drivers and paste content into “formula1” folder:
https://www.mycloud.ch/s/S00D9B6A67084D41420A1EE31889EFB40A58F05CD91
paste this into your “configuration.yaml” and restart HA
rest:
- scan_interval: 86400
resource_template: https://ergast.com/api/f1/current/driverStandings.json
sensor:
- name: "F1 Drivers"
json_attributes_path: "$.MRData"
value_template: "OK"
json_attributes:
- "total"
- "StandingsTable"
- scan_interval: 86400
resource_template: https://ergast.com/api/f1/current/constructorStandings.json
sensor:
- name: "F1 Constructors"
json_attributes_path: "$.MRData"
value_template: "OK"
json_attributes:
- "total"
- "StandingsTable"
here you can find my dashboard as yaml file (sorry it’s not possible to upload it here):
it’s not the best yaml file, because I was not able to for-each these cards so I had to paste the code for drivers 20x and the code for the teams 10x
download link:
https://www.mycloud.ch/s/S00C894EC3DBEF7526337762DFB171BDBC42ED980B3
I will upload the pictures and logos later.
so you can download the zip file.
Would really appreciate that
Was just starting to download them manually but that’d be much quicker…
Outside of the soon to come images everything else seems to be working fine…thanks again