Add OS notification listener for Windows toast capture
Polls Windows notifications via winsdk UserNotificationListener API and fires matching notification CSS streams with os_listener=True. Includes history API endpoint for tracking captured notifications. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ from wled_controller.core.automations.automation_engine import AutomationEngine
|
||||
from wled_controller.core.mqtt.mqtt_service import MQTTService
|
||||
from wled_controller.core.devices.mqtt_client import set_mqtt_service
|
||||
from wled_controller.core.backup.auto_backup import AutoBackupEngine
|
||||
from wled_controller.core.processing.os_notification_listener import OsNotificationListener
|
||||
from wled_controller.api.routes.system import STORE_MAP
|
||||
from wled_controller.utils import setup_logging, get_logger
|
||||
|
||||
@@ -188,6 +189,13 @@ async def lifespan(app: FastAPI):
|
||||
# Start auto-backup engine (periodic configuration backups)
|
||||
await auto_backup_engine.start()
|
||||
|
||||
# Start OS notification listener (Windows toast → notification CSS streams)
|
||||
os_notif_listener = OsNotificationListener(
|
||||
color_strip_store=color_strip_store,
|
||||
color_strip_stream_manager=processor_manager.color_strip_stream_manager,
|
||||
)
|
||||
os_notif_listener.start()
|
||||
|
||||
yield
|
||||
|
||||
# Shutdown
|
||||
@@ -206,6 +214,12 @@ async def lifespan(app: FastAPI):
|
||||
except Exception as e:
|
||||
logger.error(f"Error stopping automation engine: {e}")
|
||||
|
||||
# Stop OS notification listener
|
||||
try:
|
||||
os_notif_listener.stop()
|
||||
except Exception as e:
|
||||
logger.error(f"Error stopping OS notification listener: {e}")
|
||||
|
||||
# Stop all processing
|
||||
try:
|
||||
await processor_manager.stop_all()
|
||||
|
||||
Reference in New Issue
Block a user