Formula One Card

Sorry I’m looking at ot on mobile, but can you explain what’s the problem in more detail? I will look at it tomorrow on my laptop.

Hi,

I mean it as info for you, not to complain. Because this is super nice and useful for all F1 fans on HA. :slight_smile:

This is what it looks like when I put the cards in my dashboard. If you look all the way to the right, you will see that the contents of the Schedule card extend outside the card. That’s what I meant.

I could change this with cardmod, as I showed in the modified version. But then it doesn’t look good on mobile. On mobile, of course, the cards are vertically aligned. But then you see that the Schedule card content is aligned very differently than the other 2. Photos from mobile also added.

Groeten uit Overijssel




Oh yeah now I see. Never noticed this. I will look at it when I have time

1 Like

Have you checken the newest version? Should be fixed

Hi Marco,

Great work, I managed to install it manually as I couldn’t figure out where to find it in HACS (wasn’t able to find a repository to add)

After manual installation I added the piece of code into the config.yaml but that still didn’t show the card.

What eventually solved my issue was manually adding the script to the cards, so that the card would show up in the card selection menu.

I have a feeling I can just remove the code from the config.yaml now I’ve got the card to work in another way.

As a feature request, could you include teamnames and flags in the driver standings?

Bedankt!!

A good request, I would like that too :wink:

1 Like

Hi Marco,

I did today. But sorry without styling with cardmod, the contents of the card are still outside the card itself.

Can you make a feature request for it here: Sign in to GitHub · GitHub ?

1 Like

You have double headers, do you have some kind of styling set up?

:wink:

1 Like

Next race card gives me an error today (did not see it yesterday, not sure if it was there already):


not sure where to look for that date part… sensor data don’t show anything weird for race 21

1 Like

This is because next race doesnt have a 3rd practice. Fix is on its way

2 Likes

Your are lightning fast! Thank you, Marco :wink:

1 Like

Hi @marcokreeft87,
No I don’t have any Styling in this setup.

  - badges:
    panel: true
    cards:
      - type: horizontal-stack
        cards:
          - type: vertical-stack
            cards:
              - color: rgb(238, 238, 238)
                color_type: card
                name: Next Race
                styles:
                  card:
                    - height: 25px
                type: 'custom:button-card'
              - type: custom:formulaone-card
                card_type: next_race
                sensor: sensor.formula_one_sensor_races
                title: Next Race
                date_locale: nl
                image_clickable: false
          - type: vertical-stack
            cards:
              - color: rgb(238, 238, 238)
                color_type: card
                name: Driver Standings
                styles:
                  card:
                    - height: 25px
                type: 'custom:button-card'
              - type: custom:formulaone-card
                card_type: driver_standings
                sensor: sensor.formula_one_sensor_drivers
                title: Driver Standings
          - type: vertical-stack
            cards:
              - color: rgb(238, 238, 238)
                color_type: card
                name: Constructor Standings
                styles:
                  card:
                    - height: 25px
                type: 'custom:button-card'
              - type: custom:formulaone-card
                card_type: constructor_standings
                sensor: sensor.formula_one_sensor_constructors
                title: Constructor Standings
          - type: vertical-stack
            cards:
              - color: rgb(238, 238, 238)
                color_type: card
                name: Schedule
                styles:
                  card:
                    - height: 25px
                type: 'custom:button-card'
              - type: custom:formulaone-card
                card_type: schedule
                sensor: sensor.formula_one_sensor_races
                title: Schedule
                date_locale: nl



Hmm I think the problem is your theme…

As you can see I dont have the horizontal scroll.

Also why do you have the button cards above the F1 cards?

After updating to 2022.1 and then updating the card I now get this:


I’m now sure what was the cause: I didn’t think to check inbetween.

The log mentions a lot of errors:

2022-11-03 19:24:56.718 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.formula_one_sensor_races fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
    raise exc
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/formulaone_api/formulaonesensor.py", line 60, in update
    self.set_state()
  File "/config/custom_components/formulaone_api/racessensor.py", line 45, in set_state
    all_attr = self.get_race_data()
  File "/config/custom_components/formulaone_api/racessensor.py", line 19, in get_race_data
    races = f1.current_schedule().json
  File "/config/custom_components/formulaone_api/ergast.py", line 39, in json
    return self._json.json()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-11-03 19:24:56.738 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.formula_one_sensor_constructors fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
    raise exc
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/formulaone_api/formulaonesensor.py", line 60, in update
    self.set_state()
  File "/config/custom_components/formulaone_api/constructorsensor.py", line 30, in set_state
    all_attr = self.get_race_data()
  File "/config/custom_components/formulaone_api/constructorsensor.py", line 18, in get_race_data
    constructors = f1.constructor_standings(season=now.year).json
  File "/config/custom_components/formulaone_api/ergast.py", line 39, in json
    return self._json.json()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-11-03 19:24:56.747 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.formula_one_sensor_drivers fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

That list goes on and on…

The underlying integration API is broken. Need investigation, seems a no response from external system

1 Like

real source is having issues
http://ergast.com/mrd/ no db connection

1 Like

It’s back, i only have one card not working yet

Is it possible to adapt this card to the WEC (World Endurance Championship)?