Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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
Appearance settings

Commit72dcec8

Browse files
authored
Merge pull request#5 from zacs/dev
merge bye week fixes from dev
2 parentsceae01b +0f246f7 commit72dcec8

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

‎custom_components/nfl/__init__.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,25 @@ async def async_get_state(config) -> dict:
239239

240240
# Never found the team. Either a bye or a post-season condition
241241
ifnotfound_team:
242-
_LOGGER.debug("Did not find a game with for the configured team. Is it a bye week?")
243-
values["state"]='BYE'
242+
_LOGGER.debug("Did not find a game with for the configured team. Checking if it's a bye week.")
243+
found_bye=False
244+
values=awaitasync_clear_states(config)
245+
forbye_teamindata["week"]["teamsOnBye"]:
246+
ifteam_id.lower()==bye_team["abbreviation"].lower():
247+
_LOGGER.debug("Bye week confirmed.")
248+
found_bye=True
249+
values["team_abbr"]=bye_team["abbreviation"]
250+
values["team_name"]=bye_team["shortDisplayName"]
251+
values["team_logo"]=bye_team["logo"]
252+
values["state"]='BYE'
253+
values["last_update"]=arrow.now().format(arrow.FORMAT_W3C)
254+
iffound_bye==False:
255+
_LOGGER.debug("Team not found in active games or bye week list. Have you missed the playoffs?")
256+
values["team_abbr"]=None
257+
values["team_name"]=None
258+
values["team_logo"]=None
259+
values["state"]='NOT_FOUND'
260+
values["last_update"]=arrow.now().format(arrow.FORMAT_W3C)
244261

245262
ifvalues["state"]=='PRE'and ((arrow.get(values["date"])-arrow.now()).total_seconds()<1200):
246263
_LOGGER.debug("Event is within 20 minutes, setting refresh rate to 5 seconds.")
@@ -260,8 +277,8 @@ async def async_clear_states(config) -> dict:
260277
values= {}
261278
# Reset values
262279
values= {
263-
"state":"PRE",
264280
"date":None,
281+
"kickoff_in":None,
265282
"quarter":None,
266283
"clock":None,
267284
"venue":None,
@@ -272,12 +289,9 @@ async def async_clear_states(config) -> dict:
272289
"last_play":None,
273290
"down_distance_text":None,
274291
"possession":None,
275-
"team_abbr":None,
276292
"team_id":None,
277-
"team_name":None,
278293
"team_record":None,
279294
"team_homeaway":None,
280-
"team_logo":None,
281295
"team_colors":None,
282296
"team_score":None,
283297
"team_win_probability":None,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp