Skip to content

Commit

Permalink
Release Candidate v0.14.0 (#162)
Browse files Browse the repository at this point in the history
* Return Team and Event URL attributes
  • Loading branch information
vasqued2 authored Jul 1, 2024
1 parent 02ec536 commit a46f149
Show file tree
Hide file tree
Showing 36 changed files with 121 additions and 1 deletion.
3 changes: 3 additions & 0 deletions custom_components/teamtracker/clear_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async def async_clear_values() -> dict:
"team_abbr": None,
"opponent_abbr": None,
"event_name": None,
"event_url": None,
"date": None,
"kickoff_in": None,
"series_summary": None,
Expand All @@ -27,6 +28,7 @@ async def async_clear_values() -> dict:
"team_rank": None,
"team_homeaway": None,
"team_logo": None,
"team_url": None,
"team_colors": None,
"team_score": None,
"team_win_probability": None,
Expand All @@ -38,6 +40,7 @@ async def async_clear_values() -> dict:
"opponent_rank": None,
"opponent_homeaway": None,
"opponent_logo": None,
"opponent_url": None,
"opponent_colors": None,
"opponent_score": None,
"opponent_win_probability": None,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/teamtracker/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@

# Misc
TEAM_ID = ""
VERSION = "v0.13.0"
VERSION = "v0.14.0"
ISSUE_URL = "https://github.com/vasqued2/ha-teamtracker"
DOMAIN = "teamtracker"
ATTRIBUTION = "Data provided by ESPN"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/teamtracker/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, config: ConfigType)
self._opponent_abbr = None

self._event_name = None
self._event_url = None
self._date = None
self._kickoff_in = None
self._series_summary = None
Expand All @@ -221,6 +222,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, config: ConfigType)
self._team_rank = None
self._team_homeaway = None
self._team_logo = None
self._team_url = None
self._team_colors = None
self._team_score = None
self._team_win_probability = None
Expand All @@ -233,6 +235,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, config: ConfigType)
self._opponent_rank = None
self._opponent_homeaway = None
self._opponent_logo = None
self._opponent_url = None
self._opponent_colors = None
self._opponent_score = None
self._opponent_win_probability = None
Expand Down Expand Up @@ -308,6 +311,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
attrs["opponent_abbr"] = self.coordinator.data["opponent_abbr"]

attrs["event_name"] = self.coordinator.data["event_name"]
attrs["event_url"] = self.coordinator.data["event_url"]
attrs["date"] = self.coordinator.data["date"]
attrs["kickoff_in"] = self.coordinator.data["kickoff_in"]
attrs["series_summary"] = self.coordinator.data["series_summary"]
Expand All @@ -323,6 +327,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
attrs["team_rank"] = self.coordinator.data["team_rank"]
attrs["team_homeaway"] = self.coordinator.data["team_homeaway"]
attrs["team_logo"] = self.coordinator.data["team_logo"]
attrs["team_url"] = self.coordinator.data["team_url"]
attrs["team_colors"] = self.coordinator.data["team_colors"]
# attrs["team_colors_rbg"] = self.colors2rgb(self.coordinator.data["team_colors"])
attrs["team_score"] = self.coordinator.data["team_score"]
Expand All @@ -336,6 +341,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
attrs["opponent_rank"] = self.coordinator.data["opponent_rank"]
attrs["opponent_homeaway"] = self.coordinator.data["opponent_homeaway"]
attrs["opponent_logo"] = self.coordinator.data["opponent_logo"]
attrs["opponent_url"] = self.coordinator.data["opponent_url"]
attrs["opponent_colors"] = self.coordinator.data["opponent_colors"]
# attrs["opponent_colors_rgb"] = self.colors2rgb(self.coordinator.data["opponent_colors"])
attrs["opponent_score"] = self.coordinator.data["opponent_score"]
Expand Down
15 changes: 15 additions & 0 deletions custom_components/teamtracker/set_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ async def async_set_universal_values(
)
).upper()
new_values["event_name"] = await async_get_value(event, "shortName")
new_values["event_url"] = await async_get_value(event, "links", 0, "href")
new_values["date"] = await async_get_value(
competition, "date", default=(await async_get_value(event, "date"))
)
Expand Down Expand Up @@ -303,6 +304,20 @@ async def async_set_universal_values(
opponent, "athlete", "flag", "href", default=DEFAULT_LOGO
),
)
new_values["team_url"] = await async_get_value(
competitor,
"team",
"links",
0,
"href",
)
new_values["opponent_url"] = await async_get_value(
opponent,
"team",
"links",
0,
"href",
)
# _LOGGER.debug("%s: async_set_universal_values() 4: %s", sensor_name, sensor_name)

new_values["quarter"] = await async_get_value(
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test01.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "MIA",
"opponent_abbr": "PHI",
"event_name": "MIA @ PHI",
"event_url": "http://www.espn.com/mlb/game/_/gameId/401356264",
"date": "2022-09-08T22:45Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/mia.png",
"team_url": "https://www.espn.com/mlb/team/_/name/mia/miami-marlins",
"team_colors": [
"#0081c7",
"#0077c8"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/phi.png",
"opponent_url": "https://www.espn.com/mlb/team/_/name/phi/philadelphia-phillies",
"opponent_colors": [
"#be0011",
"#284898"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test02.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "MIL",
"opponent_abbr": "SF",
"event_name": "SF @ MIL",
"event_url": "http://www.espn.com/mlb/game?gameId=401423258",
"date": "2022-09-08T20:10Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "home",
"team_logo": "https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/mil.png",
"team_url": "https://www.espn.com/mlb/team/_/name/mil/milwaukee-brewers",
"team_colors": [
"#050C33",
"#f1f2f3"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "away",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/sf.png",
"opponent_url": "https://www.espn.com/mlb/team/_/name/sf/san-francisco-giants",
"opponent_colors": [
"#161415",
"#000000"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test03.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "CIN",
"opponent_abbr": "CHC",
"event_name": "CIN @ CHC",
"event_url": "http://www.espn.com/mlb/game/_/gameId/401356263",
"date": "2022-09-08T18:20Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/cin.png",
"team_url": "https://www.espn.com/mlb/team/_/name/cin/cincinnati-reds",
"team_colors": [
"#c41422",
"#ffffff"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/mlb/500/scoreboard/chc.png",
"opponent_url": "https://www.espn.com/mlb/team/_/name/chc/chicago-cubs",
"opponent_colors": [
"#00417d",
"#00417d"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test04.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "BGSU",
"opponent_abbr": "EKU",
"event_name": "EKU @ BGSU",
"event_url": "https://www.espn.com/college-football/game/_/gameId/401416595",
"date": "2022-09-10T20:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "home",
"team_logo": "https://a.espncdn.com/i/teamlogos/ncaa/500/189.png",
"team_url": "https://www.espn.com/college-football/team/_/id/189/bowling-green-falcons",
"team_colors": [
"#2b1000",
"#492000"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "away",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/ncaa/500/2198.png",
"opponent_url": "https://www.espn.com/college-football/team/_/id/2198/eastern-kentucky-colonels",
"opponent_colors": [
"#660819",
"#f0f0f0"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test05.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "ALA",
"opponent_abbr": "TEX",
"event_name": "ALA @ TEX",
"event_url": "https://www.espn.com/college-football/game?gameId=401403868",
"date": "2022-09-10T16:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": 1,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/ncaa/500/333.png",
"team_url": "https://www.espn.com/college-football/team/_/id/333/alabama-crimson-tide",
"team_colors": [
"#690014",
"#f1f2f3"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/ncaa/500/251.png",
"opponent_url": "https://www.espn.com/college-football/team/_/id/251/texas-longhorns",
"opponent_colors": [
"#EE7524",
"#f0f0f0"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test06.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "BUF",
"opponent_abbr": "LAR",
"event_name": "BUF @ LAR",
"event_url": "https://www.espn.com/nfl/game/_/gameId/401437654",
"date": "2022-09-09T00:20Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/nfl/500/scoreboard/buf.png",
"team_url": "https://www.espn.com/nfl/team/_/name/buf/buffalo-bills",
"team_colors": [
"#04407F",
"#c60c30"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/nfl/500/scoreboard/lar.png",
"opponent_url": "https://www.espn.com/nfl/team/_/name/lar/los-angeles-rams",
"opponent_colors": [
"#00295B",
"#b3995d"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test07.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "ORL",
"opponent_abbr": "POR",
"event_name": "POR @ ORL",
"event_url": "http://www.espn.com/soccer/match/_/gameId/633108",
"date": "2022-09-09T23:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "home",
"team_logo": "https://a.espncdn.com/i/teamlogos/soccer/500/18206.png",
"team_url": "http://www.espn.com/soccer/club/_/id/18206/orlando-pride",
"team_colors": [
"#633492",
"#a7c0dd"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "away",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/soccer/500/15362.png",
"opponent_url": "http://www.espn.com/soccer/club/_/id/15362/portland-thorns-fc",
"opponent_colors": [
"#004812",
"#000000"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test08.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "CLB",
"opponent_abbr": "MTL",
"event_name": "CLB @ MTL",
"event_url": "http://www.espn.com/soccer/match?gameId=623574",
"date": "2022-09-09T23:30Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/soccer/500/183.png",
"team_url": "http://www.espn.com/soccer/club/_/id/183/columbus-crew",
"team_colors": [
"#ffff00",
"#c9c7c8"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/soccer/500/9720.png",
"opponent_url": "http://www.espn.com/soccer/club/_/id/9720/cf-montreal",
"opponent_colors": [
"#181818",
"#c9c7c8"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test09.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "ARG",
"opponent_abbr": "FRA",
"event_name": "FRA @ ARG",
"event_url": "http://www.espn.com/soccer/match/_/gameId/633850",
"date": "2022-12-18T15:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "home",
"team_logo": "https://a.espncdn.com/i/teamlogos/countries/500/arg.png",
"team_url": "http://www.espn.com/soccer/team/_/id/202/argentina",
"team_colors": [
"#43A1D5",
"#43A1D5"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "away",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/countries/500/fra.png",
"opponent_url": "http://www.espn.com/soccer/team/_/id/478/france",
"opponent_colors": [
"#112855",
"#112855"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test10.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "DET",
"opponent_abbr": "UTAH",
"event_name": "UTAH @ DET",
"event_url": "https://www.espn.com/nba/game/_/gameId/401468616",
"date": "2022-12-21T00:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "home",
"team_logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/det.png",
"team_url": "https://www.espn.com/nba/team/_/name/det/detroit-pistons",
"team_colors": [
"#FA002C",
"#006bb6"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "away",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/utah.png",
"opponent_url": "https://www.espn.com/nba/team/_/name/utah/utah-jazz",
"opponent_colors": [
"#000000",
"#fff21f"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test11.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "UTAH",
"opponent_abbr": "TOR",
"event_name": "UTAH @ TOR",
"event_url": "https://www.espn.com/nba/game?gameId=401474846",
"date": "2022-10-02T22:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/utah.png",
"team_url": "https://www.espn.com/nba/team/_/name/utah/utah-jazz",
"team_colors": [
"#06143F",
"#f9a01b"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/tor.png",
"opponent_url": "https://www.espn.com/nba/team/_/name/tor/toronto-raptors",
"opponent_colors": [
"#CE0F41",
"#061922"
Expand Down
3 changes: 3 additions & 0 deletions tests/tt/results/test_tt_all_test12.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"team_abbr": "CHA",
"opponent_abbr": "BOS",
"event_name": "CHA @ BOS",
"event_url": "http://www.espn.com/nba/game/_/gameId/401474845",
"date": "2022-10-02T17:00Z",
"kickoff_in": "{test} days",
"series_summary": null,
Expand All @@ -19,6 +20,7 @@
"team_rank": null,
"team_homeaway": "away",
"team_logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/cha.png",
"team_url": "https://www.espn.com/nba/team/_/name/cha/charlotte-hornets",
"team_colors": [
"#1D1060",
"#008ca8"
Expand All @@ -33,6 +35,7 @@
"opponent_rank": null,
"opponent_homeaway": "home",
"opponent_logo": "https://a.espncdn.com/i/teamlogos/nba/500/scoreboard/bos.png",
"opponent_url": "https://www.espn.com/nba/team/_/name/bos/boston-celtics",
"opponent_colors": [
"#006532",
"#f1f2f3"
Expand Down
Loading

0 comments on commit a46f149

Please sign in to comment.