From 7f8bdefa3987a4619fba7846f60609af6a5ea71d Mon Sep 17 00:00:00 2001 From: imonlinux <39863321+imonlinux@users.noreply.github.com> Date: Sat, 11 Oct 2025 12:38:00 -0700 Subject: [PATCH] Adds two new fields to the ServerState dataclass: event_bus: EventBus loop: asyncio.AbstractEventLoop This provides a globally accessible instance of the event bus and the main asyncio event loop to any component that needs them. --- linux_voice_assistant/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux_voice_assistant/models.py b/linux_voice_assistant/models.py index 4ca4f9e..a7a7dfd 100644 --- a/linux_voice_assistant/models.py +++ b/linux_voice_assistant/models.py @@ -1,5 +1,6 @@ """Shared models.""" +import asyncio import json import logging from dataclasses import asdict, dataclass, field @@ -8,6 +9,8 @@ from pathlib import Path from queue import Queue from typing import TYPE_CHECKING, Dict, List, Optional, Union +from .event_bus import EventBus + if TYPE_CHECKING: from .entity import ESPHomeEntity, MediaPlayerEntity from .microwakeword import MicroWakeWord @@ -74,6 +77,8 @@ class ServerState: preferences: Preferences preferences_path: Path libtensorflowlite_c_path: Path + event_bus: EventBus + loop: asyncio.AbstractEventLoop # openWakeWord oww_melspectrogram_path: Path