Skip to content

Commit

Permalink
Release Candidate 9.0 (#109)
Browse files Browse the repository at this point in the history
- Added native support for Women's World Cup (WWC)
- Allowed use of ESPN's unique team_id number to identify teams in addition to team abbreviations
- Updated documentation to clarify values to use for team_id
  • Loading branch information
vasqued2 authored Jul 16, 2023
1 parent 89cc134 commit 1722cf1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following leagues are supported natively:
- Hockey - NHL
- MMA - UFC
- U.S. Soccer - MLS, NWSL
- International Soccer - BUND (German Bundesliga), CL (Champions League), EPL (English Premiere League), LIGA (Spanish LaLiga), LIG1 (French Ligue 1), SERA (Italian Serie A), WC (World Cup)
- International Soccer - BUND (German Bundesliga), CL (Champions League), EPL (English Premiere League), LIGA (Spanish LaLiga), LIG1 (French Ligue 1), SERA (Italian Serie A), WC (World Cup), WWC (Women's World Cup)
- Racing - F1, IRL
- Tennis - ATP, WTA
- Volleyball - NCAAVB, NCAAVBW
Expand Down Expand Up @@ -149,10 +149,21 @@ type: Javascript Module

### Configuration via the "Configuration->Integrations" section of the Home Assistant UI

Search for the integration labeled "Team Tracker" and select it. Enter the desired League from the League List below and your team's ID in the UI prompt. If NCAA football or basketball, enter the Conference ID from Conference ID Numbers below if desired. You can also enter a friendly name. If you keep the default, your sensor will be `sensor.team_tracker`, otherwise it will be `sensor.friendly_name_you_picked`.
1. Search for the integration labeled "Team Tracker" and select it.
2. Enter the desired League from the League List.
3. Enter the team's ID in the UI prompt.
4. If NCAA football or basketball, enter the Conference ID from Conference ID Numbers below if desired.
5. You can also enter a friendly name. If you keep the default, your sensor will be `sensor.team_tracker`, otherwise it will be `sensor.friendly_name_you_picked`.

When using the Home Assistant UI to set up a Custom API Configuration, simply enter 'XXX' in the League field. This will trigger a second dialogue box which will allow you to enter the values for the {SPORT_PATH} and {LEAGUE_PATH}.

#### Determining the Team ID
For the Team ID, you'll need to know the team abbreviation ESPN uses for your team. This is the 2-, 3- or 4-letter abbreviation (eg. "SEA" for Seattle or "NE" for New England) ESPN uses when space is limited. You can generally find them at https://espn.com/ in the top scores UI, but they can also be found in other pages with team stats as well.

Alternate Method: ESPN assigns a unique number to identify a team. This unique number shows up in URLs and other locations. This value can also be used to specify the team ID. If used, TeamTracker will also search for this number to uniquely identify a team.

For sports involving individual athletes, you should use the athlete's name as the search string. You should use as much as is needed to uniquely identify the desired athlete.

#### Use of a Wild Card In Place of Athlete's Name

You can use the single `*` character as a Wild Card in place of the team or athlete's name. This will cause the sensor to match a team or athlete using sport-specific logic.
Expand Down Expand Up @@ -239,6 +250,8 @@ For the League, the following values are valid:
- WTA (Women's Tennis Assc.)
- XXX (Custom API Configuration)

### Team ID

For the Team, you'll need to know the team ID ESPN uses for your team. This is the 2-, 3- or 4-letter abbreviation (eg. "SEA" for Seattle or "NE" for New England) ESPN uses when space is limited. You can generally find them at https://espn.com/ in the top scores UI, but they can also be found in other pages with team stats as well.

NOTE: In rare instances, the team ID will vary based on your local language. While rare, changing the language after a sensor is set up can cause it to stop working.
Expand Down
6 changes: 5 additions & 1 deletion custom_components/teamtracker/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@
CONF_SPORT_PATH: SOCCER,
CONF_LEAGUE_PATH: "fifa.world",
},
"WWC": {
CONF_SPORT_PATH: SOCCER,
CONF_LEAGUE_PATH: "fifa.wwc",
},
"ATP": {
CONF_SPORT_PATH: TENNIS,
CONF_LEAGUE_PATH: "atp",
Expand Down Expand Up @@ -180,7 +184,7 @@

# Misc
TEAM_ID = ""
VERSION = "v0.8.1"
VERSION = "v0.9.0"
ISSUE_URL = "https://github.com/vasqued2/ha-teamtracker"
DOMAIN = "teamtracker"
ATTRIBUTION = "Data provided by ESPN"
Expand Down
12 changes: 12 additions & 0 deletions custom_components/teamtracker/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ async def async_find_search_key(
)
return team_index

team_id = str(await async_get_value(
competitor, "team", "id", default=""
))

if search_key == team_id:
_LOGGER.debug(
"%s: Found competition for team '%s' in team id; parsing data.",
sensor_name,
search_key,
)
return team_index

# Abbreviations in event_name can be different than team_abbr so look there if neither team abbrevations match
team0_abbreviation = str(
await async_get_value(
Expand Down
2 changes: 1 addition & 1 deletion tests/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"sensor_name": "test_tt_all_test16",
"sport": "volleyball",
"league": "NCAAVBW",
"team_abbr": "PEPP",
"team_abbr": "2492", #PEPP
},
{
"sensor_name": "test_tt_all_test17",
Expand Down

0 comments on commit 1722cf1

Please sign in to comment.