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

Commit5745934

Browse files
authored
Merge pull request#7 from zacs/dev
Fix playoff status
2 parents4fae73a +e06a0fd commit5745934

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

‎custom_components/nfl/__init__.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,30 @@ async def async_get_state(config) -> dict:
242242
_LOGGER.debug("Did not find a game with for the configured team. Checking if it's a bye week.")
243243
found_bye=False
244244
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)
245+
try:# look for byes in regular season
246+
forbye_teamindata["week"]["teamsOnBye"]:
247+
ifteam_id.lower()==bye_team["abbreviation"].lower():
248+
_LOGGER.debug("Bye week confirmed.")
249+
found_bye=True
250+
values["team_abbr"]=bye_team["abbreviation"]
251+
values["team_name"]=bye_team["shortDisplayName"]
252+
values["team_logo"]=bye_team["logo"]
253+
values["state"]='BYE'
254+
values["last_update"]=arrow.now().format(arrow.FORMAT_W3C)
255+
iffound_bye==False:
256+
_LOGGER.debug("Team not found in active games or bye week list. Have you missed the playoffs?")
257+
values["team_abbr"]=None
258+
values["team_name"]=None
259+
values["team_logo"]=None
260+
values["state"]='NOT_FOUND'
261+
values["last_update"]=arrow.now().format(arrow.FORMAT_W3C)
262+
except:
263+
_LOGGER.debug("Team not found in active games or bye week list. Have you missed the playoffs?")
264+
values["team_abbr"]=None
265+
values["team_name"]=None
266+
values["team_logo"]=None
267+
values["state"]='NOT_FOUND'
268+
values["last_update"]=arrow.now().format(arrow.FORMAT_W3C)
261269

262270
ifvalues["state"]=='PRE'and ((arrow.get(values["date"])-arrow.now()).total_seconds()<1200):
263271
_LOGGER.debug("Event is within 20 minutes, setting refresh rate to 5 seconds.")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp