Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

NFL game scores custom component for Home Assistant

NotificationsYou must be signed in to change notification settings

SimplySynced/ha-nfl

 
 

Repository files navigation

This integration fetches data for an NFL team's current/future game, and creates a sensor with attributes for the details of the game.

You can find examples of interesting automationsin the wiki (please add your own examples!). There is also a greatcustom card that leverages this sensor, built by @D34DC3N73R.

The integration is a shameless fork of the excellentNWS alerts custom component by @finity69x2.Thank you for the starting place!

Sensor Data

State

The sensor is pretty simple: the main state isPRE,IN,POST,BYE orNOT_FOUND, but there are attributes for pretty much all aspects of the game, when available. State definitions are as you'd expect:

  • PRE: The game is in pre-game state. This happens on the first day of the game week, which seems to be Tuesday evenings around midnight Eastern time (once all the games through the Monday Night Football game are wrapped up).
  • IN: The game is in progress.
  • POST: The game has completed.
  • BYE: Your given team has a bye week this week. Note that attributes available are limited in this case (only abreviation, name, logo, and last updated time will be available).
  • NOT_FOUND: There is no game found for your team, nor is there a bye. This should only happen at the end of the season, and once your team is eliminated from postseason play.

Attributes

The attributes available will change based on the sensor's state, a small number are always available (team abbreviation, team name, and logo), but otherwise the attributes only populate when in the current state. The table below lists which attributes are available in which states.

NameValueRelevant States
dateDate and time of the gamePREINPOST
kickoff_inHuman-readable string for how far away the game is (eg. "in 30 minutes" or "tomorrow")PREINPOST
quarterThe current quarter of gameplayIN
clockThe clock value within the quarter (should never be higher than 15:00)IN
venueThe name of the stadium where the game is being played (eg. "Arrowhead Stadium")PREINPOST
locationThe city and state where the game is being played (eg. "Pittsburgh, PA")PREINPOST
tv_networkThe TV network where you can watch the game (eg. "NBC" or "NFL"). Note that if there is a national feed, it will be listed here, otherwise the local affiliate will be listed.PREINPOST
oddsThe betting odds for the game (eg. "PIT -5.0")PRE
overunderThe over/under betting line for the total points scored in the game (eg. "42.5").PRE
possessionThe ID of the team in possession of the ball. This will correlate toteam_id oropponent_id below. Note that this value will be null in between posessions (after a score, etc).IN
last_playSentence describing the most recent play, usually including the participants from both offense and defense, and the resulting yards. Note this can be null on posession changes or in between quarters.IN
down_distance_textString for the down and yards to go (eg. "2nd and 7").IN
team_abbrThe abbreviation for your team (ie.SEA for the Seahawks).PREINPOSTBYE
team_idA numeric ID for your team, used to matchpossession above.PREINPOST
team_nameYour team's name (eg. "Seahawks"). Note this does not include the city name.PREINPOSTBYE
team_recordYour team's current record (eg. "2-3").PREINPOST
team_homeawayYour team's home/away status. Eitherhome oraway.PREINPOST
team_logoA URL for a 500px wide PNG logo for the team.PREINPOSTBYE
team_colorsAn array with two hex colors. The first is your team's primary color, and the second is their secondary color. Unless you're the Browns, in which case they are the same.PREINPOST
team_scoreYour team's score. An integer.INPOST
team_win_probabilityThe real-time chance your team has to win, according to ESPN. A percentage, but presented as a float. Note that this value can become null in between posession changes.IN
team_timeoutsThe number of remaining timeouts your team has.PREINPOST
opponent_abbrThe abbreviation for your opponent (ie.SEA for the Seahawks).PREINPOSTBYE
opponent_idA numeric ID for your opponent, used to matchpossession above.PREINPOST
opponent_nameYour opponent's name (eg. "Seahawks"). Note this does not include the city name.PREINPOSTBYE
opponent_recordYour opponent's current record (eg. "2-3").PREINPOST
opponent_homeawayYour opponent's home/away status. Eitherhome oraway.PREINPOST
opponent_logoA URL for a 500px wide PNG logo for the opponent.PREINPOSTBYE
opponent_colorsAn array with two hex colors. The first is your opponent's primary color, and the second is their secondary color.PREINPOST
opponent_scoreYour opponent's score. An integer.INPOST
opponent_win_probabilityThe real-time chance your opponent has to win, according to ESPN. A percentage, but presented as a float. Note that this value can become null in between posession changes.IN
opponent_timeoutsThe number of remaining timeouts your opponent has.PREINPOST
last_updateA timestamp for the last time data was fetched for the game. If you watch this in real-time, you should notice it updating every 10 minutes, except for during the game (and for the ~20 minutes pre-game) when it updates every 5 seconds.PREINPOSTBYE

Installation

Manually

Clone or download this repository and copy the "nfl" directory to your "custom_components" directory in your config directory

<config directory>/custom_components/nfl/...

HACS

  1. Open the HACS section of Home Assistant.
  2. Click the "..." button in the top right corner and select "Custom Repositories."
  3. In the window that opens paste this Github URL.
  4. In the window that opens when you select it click om "Install This Repository in HACS"

Configuration

You'll need to know your team ID, which is a 2- or 3-letter acronym (eg. "SEA" for Seattle or "NE" for New England). You can find yours athttps://espn.com/nfl in the top scores UI.

Via the "Configuration->Integrations" section of the Home Assistant UI

Look for the integration labeled "NFL" and enter your team's acronym in the UI prompt. You can also enter a friendly name. If you keep the default, your sensor will besensor.nfl, otherwise it will besensor.friendly_name_you_picked.

Manually in yourconfiguration.yaml file

To create a sensor instance add the following configuration to your sensor definitions using the team_id found above:

- platform: nfl  team_id: 'SEA'

After you restart Home Assistant then you should have a new sensor calledsensor.nfl in your system.

You can overide the sensor default name (sensor.nfl) to one of your choosing by setting thename option:

- platform: nfl  team_id: 'SEA'  name: Seahawks

Using the configuration example above the sensor will then be called "sensor.seahawks".

About

NFL game scores custom component for Home Assistant

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python100.0%

[8]ページ先頭

©2009-2025 Movatter.jp