Add Football Card to Home Assistant

by Danny
0 comment

READING TIME: 5 MINUTES

In this guide, I’m going to show you how to add your favorite football team to Home Assistant via Google Calendar. I’ve posted a similar Upcoming Sports Card guide a while back, but since football season is upon us – I’m going to quickly show you how to create the perfect football Lovelace card.

The primary reason I’m creating a 2nd guide for football is because in my first guide – I added Michigan State Spartans basketball, but now I’m adding their football schedule. The calendar names are both “Michigan State Spartans”, so there’s a little bit more work that needs to be done to differentiate between the football vs basketball schedule.

Otherwise, Google Calendar in Home Assistant will only show 1 calendar.

Let’s get started!


Step 1: Subscribe to your football team in Google Calendar

To get your team’s schedule, you’ll need to subscribe to your team via Google Calendar https://calendar.google.com.

Under the Other Calendars sidebar tab, click the + sign. Then click Browse calendars of interest.

Under the Sports section, locate your football team.

Under the Calendar settings for your football team, you need to edit the name from the default Michigan State Spartans to Michigan State Spartans Football. If you can’t tell which calendar is which, just look at the calendar ID and it’ll say NCAA.


Step 3: Setup Google Calendar integration

Next, follow my How To Setup Google Calendar in Home Assistant guide if you don’t already have it integrated.


Step 4: Edit Google_calendars.yaml

Next, we need to edit the device ID in your google_calendars.yaml file.

File Editor > google_calendars.yaml. Locate the NCAAf cal_id. Add _football to the device_id field and update the name.

Then save and reboot Home Assistant again.


After rebooting, you should be able to see both schedules – one for basketball(if you had that setup previously) and now one for football.

Note: If you don’t have your team added under a different sport (i.e – basketball), you can skip this step. It should just show up in your calendar already.


Step 5: Verify HA Calendar Shows Both Sports

In Home Assistant, you should now be able to see both sports for the same team:


Step 6: Add Sensors to config file

Next, you need to figure out what your football calendar entity is called (Configuration > Entities > search for “football)

Then, paste this into your sensor: block of your configuration.yaml (File Editor > configuration.yaml). If you don’t have a sensor block defined yet, just add a sensor: to the top of the code below and make sure to indent properly.

Green: Create sensor names for your team

Red: Replace with your calendar entity ID

Blue: Replace friendly name

  #MSU Football Next Game
  - platform: template
    sensors:
      msu_football_date:
        friendly_name: MSU Football next game
        value_template: >-
          {% if is_state('calendar.michigan_state_spartans_football', 'on') %}
            Playing Now
          {% else %}
            {% set st = state_attr('calendar.michigan_state_spartans_football', 'start_time') %}
            {% if st != None %}
              {{ as_timestamp(st)  | timestamp_custom("%a, %b %d at %-I:%M %p") }}
            {% else %}
              No games scheduled
            {% endif %}
          {% endif %}
  # MSU Football Next Opponent
  - platform: template
    sensors:
      msu_football_opponent:
        friendly_name: MSU Football Next Opponent
        value_template: >-
          {{ states.calendar.michigan_state_spartans_football.attributes.message }}

Then, reboot Home Assistant.


Step 7: Create Lovelace Card to Show Upcoming Football Games & Scores

Now onto the fun part: creating the Lovelace card! Here’s what we’ll be creating. The game isn’t currently playing, but once it is – it’ll say “Playing Now” and will show the score under each team.

And once the game IS playing, here’s how the card looks:

To do this, you need to install Multiple Entity Row and Vertical Stack in Card from the Home Assistant Community Store. (HACS).

Then, create a new Manual card and paste this in (replace with your own entities):

type: vertical-stack
cards:
  - type: entities
    entities:
      - type: custom:multiple-entity-row
        entity: sensor.msu_football_date
        image: /local/icons/msu.png
        name: Next Game
        secondary_info:
          entity: sensor.msu_football_opponent
          name: false
    title: MSU Football Games

To get a custom image into your card like I’ve done, open your www folder, create a folder called icons, and then upload your round transparent PNG files. You will then use this in your card image: /local/icons/msu.png

More step-by-step details for this are in the Add Custom Logos for Entities section of this post.


Wrapping Up

Hopefully you guys find this tutorial/card useful this football season! If you have any suggestions for cool automations using this, let me know what you come up in the comments below!

If you’d like to be notified before a game starts, follow my Create Home Assistant Google Calendar Notifications guide.


My Favorite Home Assistant Devices

Below are some of the Home Assistant-compatible devices I personally use in my home. I highly recommend each of them.

The full list of all Home Assistant compatible & recommended devices I use can be found on my Equipment List page.

0 comment

You may also like

Leave a Comment