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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user