Formula One Card

Discovered the same issue today.

Trying to access https://ergast.com/api/f1/current.json results in the following message:
“Websites prove their identity via certificates, which are valid for a set time period. The certificate for ergast.com expired on 29/08/2023.”

Is there a way to get the countdown as a sensor in HA so it can be used to implement it with other things?

There are one or two solution provided in the topic

Ah right, didn’t spit through all of the 244 other messages :sweat_smile: seems I need to though :rofl:

Hi, can i also have the code please?

Easiest way to get notifications and track race progress.

Instal HACS Integration - ICS KoljaWindeler/ics

ICS calendar for für Formel 1

Download - GP and qualifying round

Add your ICS calendar under /config/www/calendar

Example of automation notifications

Mardown card or Optional same template code for sensor tts notifications

Formel 1 United States GP Qualifying, in Austin, Startet in: 8 Tagen, 11 Stunden, 38 Minuten 

=

type: markdown
content: |-
  {% set event_start = state_attr('sensor.ics_4', 'start') %}
  {% set current_time = now() %}
  {% set time_delta = event_start - current_time %}
  {% set description = state_attr('sensor.ics_4', 'description') %}
  {% set location = state_attr('sensor.ics_4', 'location') %}
  {% if time_delta.total_seconds() <= 0 %}
    Formel 1, {{ description }}, läuft bereits
  {% else %}
    {% set days = time_delta.days %}
    {% set seconds = time_delta.seconds %}
    {% set hours = seconds // 3600 %}
    {% set minutes = (seconds % 3600) // 60 %}
    {% set remaining_time = [] %}
    {% if days > 0 %}
      {% set remaining_time = remaining_time + [days ~ ' Tagen'] %}
    {% endif %}
    {% if hours > 0 %}
      {% set remaining_time = remaining_time + [hours ~ ' Stunden'] %}
    {% endif %}
    {% if minutes > 0 %}
      {% set remaining_time = remaining_time + [minutes ~ ' Minuten'] %}
    {% endif %}
    {{ 'Formel 1 ' ~ description ~ ' in ' ~ location ~ ' Startet in: ' ~ ', '.join(remaining_time) }}
  {% endif %}

Optional
Node Red Alexa tts

[{"id":"d0697afac806deaa","type":"function","z":"1f4a4002563530a1","name":"Sensor zu Text","func":"// Hier den Sensorwert entsprechend vorbereiten\nvar sensorValue = msg.data.attributes.description;\nvar attribute1 = msg.data.attributes.start;\nvar attribute2 = msg.data.attributes.location;\nvar attribute3 = msg.data.attributes.remaining;\n\n\n// Fahren Sie fort, weitere Attribute nach Bedarf hinzuzufügen\n\n// Hier den Text für Alexa erstellen\nvar alexaText = \"Formel eins, \" + sensorValue + \", in \" + attribute2 + \", Startet in \" + attribute3 + \" Tagen\" ;\n\n// Die Nachricht aktualisieren\nmsg.payload = alexaText;\n\n// Die Nachricht zurückgeben\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":600,"wires":[["2e01339c3e8db24c"]]},{"id":"545023a7da4231d4","type":"api-current-state","z":"1f4a4002563530a1","name":"Formel 1","server":"1612d3ca.3c79fc","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.ics_4","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":300,"y":600,"wires":[["d0697afac806deaa"]]},{"id":"2e01339c3e8db24c","type":"api-call-service","z":"1f4a4002563530a1","name":"Text an Alexa","server":"1612d3ca.3c79fc","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media_alexa_echo_dot","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload}}\",\"title\":\"Formula 1\",\"data\":{\"method\":\"all\",\"push\":{\"thread-id\":\"Tonnen\"}}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":660,"y":600,"wires":[["fe5dc19c205bcf5e"]]},{"id":"aacd23573b745971","type":"ha-time","z":"1f4a4002563530a1","name":"15Min. vor Formula 1 Start","server":"1612d3ca.3c79fc","version":3,"exposeAsEntityConfig":"","entityId":"sensor.ics_4","property":"attributes.start","offset":"-15","offsetType":"num","offsetUnits":"minutes","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":110,"y":600,"wires":[[]]},{"id":"1612d3ca.3c79fc","type":"server","name":"My Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]

or with extra template sensor

[{"id":"95fcd35f8982b7d8","type":"ha-time","z":"1f4a4002563530a1","name":"15Min. vor Formula 1 Start","server":"1612d3ca.3c79fc","version":3,"exposeAsEntityConfig":"","entityId":"sensor.ics_4","property":"attributes.start","offset":"-15","offsetType":"num","offsetUnits":"minutes","randomOffset":false,"repeatDaily":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"sunday":true,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"x":110,"y":500,"wires":[["d53663e392910d5f"]]},{"id":"d53663e392910d5f","type":"api-current-state","z":"1f4a4002563530a1","name":"Formel 1","server":"1612d3ca.3c79fc","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.custom_formula_1_startzeit","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":320,"y":500,"wires":[["99680d5520d2718b"]]},{"id":"99680d5520d2718b","type":"api-call-service","z":"1f4a4002563530a1","name":"Text an Alexa","server":"1612d3ca.3c79fc","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media_alexa_echo_dot","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload}}\",\"title\":\"Formula 1\",\"data\":{\"method\":\"all\",\"push\":{\"thread-id\":\"Tonnen\"}}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":580,"y":500,"wires":[["fca557b2303bced2"]]},{"id":"1612d3ca.3c79fc","type":"server","name":"My Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]

This was already posted twice in here, but thanks!

Is it just me or isn’t the next_race card showing the date / time section anymore. Goes for the weather info too. Havent seen it for a while now, but didn’t have time to report it yet. Should I create a github issue for it, or is it just me?

My code is pretty simple:

</s> <s>type: custom:formulaone-card</s> <s>card_type: next_race</s> <s>title: Volgende race</s> <s>date_locale: nl</s> <s>image_clickable: false</s> <s>f1_font: true</s> <s>show_weather: true</s> <s>weather_options:</s> <s> unit: metric</s> <s> api_key: longkey</s> <s>

n/m show_raceinfo was missing. My apologies

1 Like

Good news, I’ve finished the visual editor, so no more typing yaml necessary with v1.8.7!

3 Likes

The Las Vegas circuit is not displayed.

Perhaps it’s just that races that happen in Vegas stay in Vegas?

2 Likes

You got it! Haha no there is already a issue reported. But I have to find a replacement for the API and I don’t have te time right now so I’m gonna fix both things together.

So you’ll have to deal with the image missing of hide the tracklayout for this race

Ive fixed the las vegas layout, could be necessary to empty cache

4 Likes

Date on Las Vegas seems wrong. It says 18th Nov in schedule, so it doesn’t show as coming up.

Yeah the API f**** up again.

Thought so, couldn’t figure it out, so be it

After installing the card, it shows the data of 2023 season. How can I change it to the 2024 season? Thanks!

Goes automatically, when season starts. It’s just too early now :slight_smile:

1 Like

It’s not too early, source is slow :wink:. We know what date the first race will be, so let them update the api soon please :yum:

Yeah about that. The API is giving far less data now. Making it basically useless. Ive submitted a ticket so lets wait for that.

2 Likes