Skip to content

Add sports-score-alert ability: live scores, schedules, and results via ESPN - #344

Merged
uzair401 merged 7 commits into
openhome-dev:devfrom
hassan1731996:feature/sports-final
Jul 24, 2026
Merged

uzair401 merged 7 commits into
openhome-dev:devfrom
hassan1731996:feature/sports-final

Conversation

@hassan1731996

Copy link
Copy Markdown
Contributor

Summary

  • Live sports scores, upcoming schedules, and recent results via ESPN's public scoreboard API
  • Supports MLB, NBA, NFL, NHL, and MLS — no API key required
  • Background daemon alerts the user when a tracked team's game starts or ends
  • Full-name keyword matching to avoid team name collisions (e.g. "Red Sox" vs "Reds")
  • 3-day lookahead for schedules, 3-day lookback for results

Trigger phrases

"sports scores", "how did [team] do", "when does [team] play", "track my teams", and more

Test plan

  • "track my teams" → setup flow, team names saved
  • "how did the Yankees do" → last result returned
  • "when do the Red Sox play" → next scheduled game within 3 days
  • "what's the score" → live score if game in progress
  • Background daemon fires when tracked team game starts/ends
  • validate_ability.py passes (exit 0)

@hassan1731996
hassan1731996 requested a review from a team as a code owner July 19, 2026 11:49
@github-actions

Copy link
Copy Markdown
Contributor

🔀 Branch Merge Check

PR direction: feature/sports-final → dev

✅ Passed — feature/sports-final → dev is a valid merge direction

@github-actions

Copy link
Copy Markdown
Contributor

✅ Community PR Path Check — Passed

All changed files are inside the community/ folder. Looks good!

@github-actions github-actions Bot added the community-ability Community-contributed ability label Jul 19, 2026
@github-actions

github-actions Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ability Validation Passed

📋 Validating: community/sports-score-alert
  ✅ All checks passed!

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Lint Results

✅ __init__.py — Empty as expected

Files linted: community/sports-score-alert/background.py community/sports-score-alert/main.py

✅ Flake8 — Passed

✅ All checks passed!

@Rizwan-095
Rizwan-095 deleted the branch openhome-dev:dev July 22, 2026 13:25
@Rizwan-095 Rizwan-095 closed this Jul 22, 2026
@Rizwan-095 Rizwan-095 reopened this Jul 22, 2026
@Rizwan-095
Rizwan-095 deleted the branch openhome-dev:dev July 23, 2026 11:29
@Rizwan-095 Rizwan-095 closed this Jul 23, 2026
@Rizwan-095 Rizwan-095 reopened this Jul 23, 2026
hassan1731996 and others added 3 commits July 24, 2026 15:14
Signed-off-by: Uzair Ullah <uzairullahmail@gmail.com>
Refactor data saving logic to check success of operations and adjust worker initialization.

Signed-off-by: Uzair Ullah <uzairullahmail@gmail.com>

@uzair401 uzair401 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hassan1731996 — this is your second PR with the same storage bug as air-quality-pollen-alert, so worth calling out clearly: please follow these patterns going forward, since they'll come up in every future ability.

  • Storage saves must be create_key-first, checking the actual success field in the response. try: update_key(...) except: create_key(...) looks reasonable but is broken — update_key doesn't raise and just no-ops on a missing key, so the very first save silently never persists.
  • Exit-word matching needs to check the whole utterance, not do a substring/word check across EXIT_WORDS. In a sports context, "stop" and "done" show up constantly in ordinary sentences ("what a stop by the goalie," "is it done yet") — a plain match exits the ability mid-conversation. It also meant "stop following the Yankees" always exited instead of reaching your own UNFOLLOW handling.
  • Daemon call() must set background_daemon_mode before constructing CapabilityWorker, and daemons should pass self, not self.worker.

Fixed all of these plus the identical background.py copy. Everything else here (the ESPN integration, the team-collision keyword matching, the in-memory-data workaround for the create_key visibility lag) is genuinely well thought out — these three patterns are just worth locking in for next time.

@uzair401
uzair401 merged commit 879aa2b into openhome-dev:dev Jul 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-ability Community-contributed ability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants