From 64e2657824b182957199fc447884e04d93a59e78 Mon Sep 17 00:00:00 2001 From: imonlinux <39863321+imonlinux@users.noreply.github.com> Date: Mon, 17 Nov 2025 21:48:08 -0800 Subject: [PATCH] Update models.py ServerState is now a pure data container, no longer holding controller instances. The satellite reference was re-added, as it's required by the audio thread to call satellite.wakeup(). Fixed a TypeError by re-ordering non-default fields. --- linux_voice_assistant/models.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/linux_voice_assistant/models.py b/linux_voice_assistant/models.py index ca2feb5..97ae49e 100644 --- a/linux_voice_assistant/models.py +++ b/linux_voice_assistant/models.py @@ -67,24 +67,25 @@ class Preferences: @dataclass class ServerState: + """A simple dataclass to hold core application state.""" # --- Fields WITHOUT default values --- name: str mac_address: str + event_bus: EventBus + loop: asyncio.AbstractEventLoop entities: "List[ESPHomeEntity]" + music_player: "MpvMediaPlayer" + tts_player: "MpvMediaPlayer" available_wake_words: "Dict[str, AvailableWakeWord]" wake_words: "Dict[str, Union[MicroWakeWord, OpenWakeWord]]" active_wake_words: Set[str] stop_word: "MicroWakeWord" - music_player: "MpvMediaPlayer" - tts_player: "MpvMediaPlayer" wakeup_sound: str timer_finished_sound: str - preferences: Preferences preferences_path: Path - event_bus: EventBus - loop: asyncio.AbstractEventLoop - download_dir: Path # <-- ADDED - + download_dir: Path + preferences: Preferences # <-- MOVED UP + # --- Fields WITH default values --- satellite: "Optional[VoiceSatelliteProtocol]" = None wake_words_changed: bool = False