Formula One Card

Hi F1-fans

I just found this integration and got the same error like justbaj. the sensors show up, but it seems that they dont get updates. maybe its just a temporary problem that they dont get data from the server.

UPDATE: seems to be working again, very nice :wink:


all the best

Andrew

yes itā€™s working again.
probably it was a problem with the API behind the integration and frontend card.

Iā€™ve just tried to get this setup for the first time and Iā€™m getting the following. Looks like this has happened before and was an issue with the backend database. Can anyone confirm if this is working for them?

image

http://ergast.com/mrd/

Error establishing a database connection

this is indeed 3rd party issueā€¦ weā€™ll need to wait to this gets resovled

1 Like

Thanks for the response. It was entirely possible I didnā€™t set something up right.

what is the font you use? It looks great!

1 Like

I think he is using a similar font to the Formula 1 font. If you search on Google you will find some alternative F1 fonts. You can add them into HomeAssistant (I also did this :slight_smile: )

cool Thanks. I PM-ed him. But I think found something online. How did you add them to ha?

Make sure you have card-mod installed.

You need to do the following:

Create folder for fonts
In your HomeAssistant folder go to www and create a new folder called ā€œfontsā€. In this folder upload the fonts (woff2 files) in my case.

Create fonts.css
create a fonts.css file and add the code below for each font you want to use. In the code the font-family is the name you want to use in the card, and the src: is the path to the font file (created above).

You can copy the code and add multiple fonts, just use the code below again for another font but change the font-family name and the path to the file.

@font-face {
  font-family: "Formula1";
  src: url(/local/fonts/f1Bold.woff2) format('woff2');
}

Create loadfonts.js
Create a new file in the folder called loadfonts.js and add the following code. Change or make sure the path in the 2nd line is the path to the fonts.css file created above.

function loadcss() {
    let css = '/local/fonts/fonts.css?v=0.01'

    let link = document.createElement('link');
    let head = document.getElementsByTagName('head')[0];
    let tmp;
    link.rel = 'stylesheet';
    link.type = 'text/css';

    tmp = link.cloneNode(true);
    tmp.href = css;
    head.appendChild(tmp);
    console.info('%c Font Style sheet loaded', 'color: white; background: #000; font-weight: 700;');
}
loadcss();

Next in HomeAssistant go to Settings ā†’ Dashboard ā†’ Custom sources and create a new source. Add the path to the js file like: /local/fonts/loadfonts.js and set is as a javascript module.

Restart HA and add the following css code in the card you want to change the font for. Make sure the font-family refers to the name set in the fonts.css file.

card_mod:
  style: |
    ha-card {
      font-family: "Formula1";
      text-align: center;
    }

Note: This is not my code, i found this on the forum somewhere after researching how to do this and this is what worked for me.

1 Like

Cool! and what if I want to use it in lovelace? just add to the theme? Thanks a lot buddy. Will start working on this. Back to on-topic :wink:

Hi. I have an error on both drivers and constructors. See attached screenshot. Perhaps you can help me fix this? I really appreciate any help you can provide.

to be honest the formula one api is causing errors continously. I guess it has something to do with all the development on the api. For me this is the reason why I disabled the integration until the season starts :-). Too annoying, and I guess has nothing to do with this card.

I am currently working on a results ( current and ability to go back in time ) card. I will slowly convert to other cards when I got the time. Then it will no longer be dependent on the API. But the API was giving the developer of the API errors because of too much request. Lets check if it will work :slight_smile:

Nah, not really - the Formula one component just didnā€™t handle a JSON without any standings in it nicely. Itā€™s empty because the season still needs to start :wink:

See my PR here for the easy fix:

v0.3.1 should make the card independent from the API. Try it out guys!

Same here and me too disabled the integration waiting the API will work as expectedā€¦

If you update the card you dont need the API anymore, at least for the card

Just upgrade to the latest version.

1 Like

Cool! But, how does the card get the data? Didnā€™t see anything in the readme for this

Its magic :stuck_out_tongue: Haha no it does javascript calls to the source of the api directly

2 Likes