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.
This commit is contained in:
imonlinux
2025-10-11 12:38:00 -07:00
committed by GitHub
parent de30740dce
commit 7f8bdefa39
+5
View File
@@ -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