Skip to content

feat(notifications): unified notification system v3.9.0#344

Merged
tempus2016 merged 13 commits into
mainfrom
feat/notifications-overhaul
May 10, 2026
Merged

feat(notifications): unified notification system v3.9.0#344
tempus2016 merged 13 commits into
mainfrom
feat/notifications-overhaul

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

Summary

Replaces TaskMate's narrow notification surface (single global notify_service + per-badge notify_on_earn) with a unified per-event, multi-recipient configuration page in the admin panel.

Four new notification types (all opt-in, default OFF):

  • 🌙 Bedtime reminder — pings the child if outstanding chores at configured time (per-child time)
  • 🔥 Streak at risk — fires when an active streak (≥2 days) hasn't been extended yet
  • 🎉 All chores done — celebration ping when a child finishes every chore for the day
  • 📋 Actionable approvals — pending chore approval and reward claim now carry mobile-app Approve / Reject action buttons (tap-to-approve from the notification banner)

Custom scheduled notifications — parents can define their own timed reminders with name, message template ({child_name} placeholder), time, day-of-week mask, and recipient list.

Power-user taskmate_* event bus — every state change emits a clean event for Node-RED / HA automations:

  • taskmate_chore_completed, taskmate_chore_approved
  • taskmate_streak_updated, taskmate_perfect_week
  • taskmate_reward_claimed
  • taskmate_badge_earned (was already there; documented now)
  • Plus per-fire taskmate_<type_id> events with recipient list

New admin tab "Notifications" with three sections:

  1. Recipients — children's notify service + free-form parent list with notify service
  2. Built-in matrix — full grid of (notification_type × recipient) toggles, master switch per row, inline per-child time for bedtime, inline global cutoff for streak-at-risk
  3. Custom scheduled — name, message, time, day mask, recipient chips

Architecture

New coord_notifications.py (NotificationCoordinator) is the single dispatcher for every notification. Other coords (coord_chores, coord_rewards, coord_points, coord_badges) stop building messages directly and call await self.notifications.fire(type_id, context). The dispatcher handles routing, message templating (with _SafeDict so missing keys don't raise), persistent_notification, per-recipient notify.* calls, mobile actionable data, and bus event emission.

10 new WebSocket commands under taskmate/notifications/* for the panel. Full migration on first load preserves existing behaviour: pending approvals, reward claims and badge earned default ON for the seeded parent recipient (migrated from legacy notify_service setting); the four new types default OFF.

Test plan

  • All 452 pytest tests pass (added 34 new tests for storage migration, dispatch, scheduler, actionable, ws, events)
  • Ruff lint clean
  • Manual smoke test on real HA instance:
    • Open the new Notifications admin tab — verify three sections render
    • On upgrade: legacy notify_service is migrated into a parent recipient row (no surprise behaviour)
    • Complete a chore as a child → parent gets actionable notification → tap Approve from the banner → chore approves without opening the app
    • Same for reward claims
    • Enable bedtime reminder for a child, set time near now → notification arrives only if child has outstanding chores
    • Add a custom scheduled notification → triggers at the configured time on enabled days only
    • In HA Developer Tools → Events, listen for taskmate_chore_completed → complete a chore → event payload visible

Migration / backwards compatibility

  • Legacy notify_service setting is preserved (not deleted) — readable for rollback
  • Pending approval / reward claim / badge earned default ON post-migration for the seeded parent — same destinations as before
  • Per-badge notify_on_earn flag still honoured (extra layer above the new master toggle)
  • All 4 new notification types default OFF — no surprise pings on upgrade

Fixes #N/A (no specific issue — direction set in chat session 2026-05-10)

Spec: docs/superpowers/specs/2026-05-10-notifications-overhaul-design.md (local)
Wireframe: .tmp/notifications-wireframe.html (local)
Plan: docs/superpowers/plans/2026-05-10-notifications-overhaul.md (local)

@tempus2016 tempus2016 merged commit 3d1001b into main May 10, 2026
2 checks passed
@tempus2016 tempus2016 deleted the feat/notifications-overhaul branch May 10, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant