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:
@@ -67,23 +67,24 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user