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.
This commit is contained in:
imonlinux
2025-11-17 21:48:08 -08:00
committed by GitHub
parent 8c6df9b245
commit 64e2657824
+8 -7
View File
@@ -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