Skip to content

Commit

Permalink
Release Candidate v0.14.6 (#204)
Browse files Browse the repository at this point in the history
- Add team long names to sensor attributes
  • Loading branch information
vasqued2 authored Jan 25, 2025
1 parent a10b438 commit 691a214
Show file tree
Hide file tree
Showing 35 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/teamtracker/clear_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async def async_clear_values() -> dict:
"odds": None,
"overunder": None,
"team_name": None,
"team_long_name": None,
"team_id": None,
"team_record": None,
"team_rank": None,
Expand All @@ -35,6 +36,7 @@ async def async_clear_values() -> dict:
"team_winner": None,
"team_timeouts": None,
"opponent_name": None,
"opponent_long_name": None,
"opponent_id": None,
"opponent_record": None,
"opponent_rank": None,
Expand Down
4 changes: 4 additions & 0 deletions custom_components/teamtracker/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, config: ConfigType)
self._overunder = None

self._team_name = None
self._team_long_name = None
self._team_id = None
self._team_record = None
self._team_rank = None
Expand All @@ -225,6 +226,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, config: ConfigType)
self._team_timeouts = None

self._opponent_name = None
self._opponent_long_name = None
self._opponent_id = None
self._opponent_record = None
self._opponent_rank = None
Expand Down Expand Up @@ -317,6 +319,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
attrs["overunder"] = self.coordinator.data["overunder"]

attrs["team_name"] = self.coordinator.data["team_name"]
attrs["team_long_name"] = self.coordinator.data["team_long_name"]
attrs["team_id"] = self.coordinator.data["team_id"]
attrs["team_record"] = self.coordinator.data["team_record"]
attrs["team_rank"] = self.coordinator.data["team_rank"]
Expand All @@ -331,6 +334,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
attrs["team_timeouts"] = self.coordinator.data["team_timeouts"]

attrs["opponent_name"] = self.coordinator.data["opponent_name"]
attrs["opponent_long_name"] = self.coordinator.data["opponent_long_name"]
attrs["opponent_id"] = self.coordinator.data["opponent_id"]
attrs["opponent_record"] = self.coordinator.data["opponent_record"]
attrs["opponent_rank"] = self.coordinator.data["opponent_rank"]
Expand Down
16 changes: 16 additions & 0 deletions custom_components/teamtracker/set_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ async def async_set_universal_values(
default=await async_get_value(competitor, "roster", "shortDisplayName")
),
)
new_values["team_long_name"] = await async_get_value(
competitor,
"team",
"displayName",
default=await async_get_value(competitor, "athlete", "displayName",
default=await async_get_value(competitor, "roster", "displayName")
),
)
new_values["opponent_name"] = await async_get_value(
opponent,
"team",
Expand All @@ -279,6 +287,14 @@ async def async_set_universal_values(
default=await async_get_value(opponent, "roster", "shortDisplayName"),
),
)
new_values["opponent_long_name"] = await async_get_value(
opponent,
"team",
"displayName",
default=await async_get_value(opponent, "athlete", "displayName",
default=await async_get_value(opponent, "roster", "displayName")
),
)

new_values["team_record"] = await async_get_value(
competitor, "records", 0, "summary"
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test01.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": "PHI -140",
"overunder": 7,
"team_name": "Marlins",
"team_long_name": "Miami Marlins",
"team_id": "28",
"team_record": "55-80",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Phillies",
"opponent_long_name": "Philadelphia Phillies",
"opponent_id": "22",
"opponent_record": "75-61",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test02.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Brewers",
"team_long_name": "Milwaukee Brewers",
"team_id": "8",
"team_record": "71-65",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Giants",
"opponent_long_name": "San Francisco Giants",
"opponent_id": "26",
"opponent_record": "65-70",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test03.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Reds",
"team_long_name": "Cincinnati Reds",
"team_id": "17",
"team_record": "55-80",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": true,
"team_timeouts": null,
"opponent_name": "Cubs",
"opponent_long_name": "Chicago Cubs",
"opponent_id": "16",
"opponent_record": "57-80",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test04.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": "BGSU -7.5",
"overunder": 57,
"team_name": "Falcons",
"team_long_name": "Bowling Green Falcons",
"team_id": "189",
"team_record": "0-1",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Colonels",
"opponent_long_name": "Eastern Kentucky Colonels",
"opponent_id": "2198",
"opponent_record": "0-1",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test05.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Crimson Tide",
"team_long_name": "Alabama Crimson Tide",
"team_id": "333",
"team_record": "1-0",
"team_rank": 1,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": 3,
"opponent_name": "Longhorns",
"opponent_long_name": "Texas Longhorns",
"opponent_id": "251",
"opponent_record": "1-0",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test06.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Bills",
"team_long_name": "Buffalo Bills",
"team_id": "2",
"team_record": "1-0",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": true,
"team_timeouts": null,
"opponent_name": "Rams",
"opponent_long_name": "Los Angeles Rams",
"opponent_id": "14",
"opponent_record": "0-1",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test07.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Orlando",
"team_long_name": "Orlando Pride",
"team_id": "18206",
"team_record": "5-6-6",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": false,
"team_timeouts": null,
"opponent_name": "Portland",
"opponent_long_name": "Portland Thorns FC",
"opponent_id": "15362",
"opponent_record": "7-7-3",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test08.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Columbus",
"team_long_name": "Columbus Crew",
"team_id": "183",
"team_record": "9-13-6",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": false,
"team_timeouts": null,
"opponent_name": "CF Montr\u00e9al",
"opponent_long_name": "CF Montr\u00e9al",
"opponent_id": "9720",
"opponent_record": "16-4-9",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test09.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Argentina",
"team_long_name": "Argentina",
"team_id": "202",
"team_record": null,
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": true,
"team_timeouts": null,
"opponent_name": "France",
"opponent_long_name": "France",
"opponent_id": "478",
"opponent_record": null,
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test10.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": "UTAH -2.5",
"overunder": 229,
"team_name": "Pistons",
"team_long_name": "Detroit Pistons",
"team_id": "8",
"team_record": "8-24",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Jazz",
"opponent_long_name": "Utah Jazz",
"opponent_id": "26",
"opponent_record": "17-16",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test11.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Jazz",
"team_long_name": "Utah Jazz",
"team_id": "26",
"team_record": "0-0",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Raptors",
"opponent_long_name": "Toronto Raptors",
"opponent_id": "28",
"opponent_record": "0-0",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test12.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Hornets",
"team_long_name": "Charlotte Hornets",
"team_id": "30",
"team_record": "0-1",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": false,
"team_timeouts": null,
"opponent_name": "Celtics",
"opponent_long_name": "Boston Celtics",
"opponent_id": "2",
"opponent_record": "1-0",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test13.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": "WPG -130",
"overunder": 6.5,
"team_name": "Jets",
"team_long_name": "Winnipeg Jets",
"team_id": "28",
"team_record": "20-10-1",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Senators",
"opponent_long_name": "Ottawa Senators",
"opponent_id": "14",
"opponent_record": "14-15-2",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test14.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Islanders",
"team_long_name": "New York Islanders",
"team_id": "12",
"team_record": "0-2-0",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Flyers",
"opponent_long_name": "Philadelphia Flyers",
"opponent_id": "15",
"opponent_record": "1-2-0",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test15.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Blue Jackets",
"team_long_name": "Columbus Blue Jackets",
"team_id": "29",
"team_record": "3-1-1",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": true,
"team_timeouts": null,
"opponent_name": "Capitals",
"opponent_long_name": "Washington Capitals",
"opponent_id": "23",
"opponent_record": "2-1-1",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test16.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Waves",
"team_long_name": "Pepperdine",
"team_id": "2492",
"team_record": "1-1",
"team_rank": 24,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Mustangs",
"opponent_long_name": "Cal Poly",
"opponent_id": "13",
"opponent_record": "0-1",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test17.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Bulldogs",
"team_long_name": "Mississippi State",
"team_id": "344",
"team_record": "5-0",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "Owls",
"opponent_long_name": "Kennesaw State",
"opponent_id": "338",
"opponent_record": "0-1",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test18.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": null,
"team_name": "Black Knights",
"team_long_name": "Army",
"team_id": "349",
"team_record": "0-1",
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": true,
"team_timeouts": null,
"opponent_name": "Orange",
"opponent_long_name": "Syracuse",
"opponent_id": "183",
"opponent_record": "3-3",
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test19.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": "Men's Singles",
"team_name": "Jan-Lennard Struff",
"team_long_name": "Jan-Lennard Struff",
"team_id": "2337",
"team_record": null,
"team_rank": null,
Expand All @@ -27,6 +28,7 @@
"team_winner": true,
"team_timeouts": null,
"opponent_name": "Francisco Cabral",
"opponent_long_name": "Francisco Cabral",
"opponent_id": "3825",
"opponent_record": null,
"opponent_rank": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/tt/results/test_tt_all_test20.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"odds": null,
"overunder": "Men's Doubles",
"team_name": "M. Fucsovics / F. Marozsan",
"team_long_name": "Marton Fucsovics / Fabian Marozsan",
"team_id": "1862-9213",
"team_record": null,
"team_rank": null,
Expand All @@ -30,6 +31,7 @@
"team_winner": null,
"team_timeouts": null,
"opponent_name": "T. Griekspoor / W. Koolhof",
"opponent_long_name": "Tallon Griekspoor / Wesley Koolhof",
"opponent_id": "3319-3191",
"opponent_record": null,
"opponent_rank": null,
Expand Down
Loading

0 comments on commit 691a214

Please sign in to comment.