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."""
|
"""Shared models."""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
@@ -8,6 +9,8 @@ from pathlib import Path
|
|||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import TYPE_CHECKING, Dict, List, Optional, Union
|
from typing import TYPE_CHECKING, Dict, List, Optional, Union
|
||||||
|
|
||||||
|
from .event_bus import EventBus
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .entity import ESPHomeEntity, MediaPlayerEntity
|
from .entity import ESPHomeEntity, MediaPlayerEntity
|
||||||
from .microwakeword import MicroWakeWord
|
from .microwakeword import MicroWakeWord
|
||||||
@@ -74,6 +77,8 @@ class ServerState:
|
|||||||
preferences: Preferences
|
preferences: Preferences
|
||||||
preferences_path: Path
|
preferences_path: Path
|
||||||
libtensorflowlite_c_path: Path
|
libtensorflowlite_c_path: Path
|
||||||
|
event_bus: EventBus
|
||||||
|
loop: asyncio.AbstractEventLoop
|
||||||
|
|
||||||
# openWakeWord
|
# openWakeWord
|
||||||
oww_melspectrogram_path: Path
|
oww_melspectrogram_path: Path
|
||||||
|
|||||||
Reference in New Issue
Block a user