1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Add bus system for handling events hw/pulse/docker (#2999)

* Add bus system for handling events hw/pulse/docker

* give sound update back

* register events

* Add tests

* Add debug logger

* Update supervisor/coresys.py

Co-authored-by: Joakim Sørensen <joasoe@gmail.com>

Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
This commit is contained in:
Pascal Vizeli
2021-08-09 19:30:26 +02:00
committed by GitHub
parent 9638775944
commit 31001280c8
8 changed files with 271 additions and 189 deletions

View File

@@ -28,7 +28,7 @@ if TYPE_CHECKING:
from .hardware.module import HardwareManager
from .hassos import HassOS
from .homeassistant.module import HomeAssistant
from .host import HostManager
from .host.manager import HostManager
from .ingress import Ingress
from .jobs import JobManager
from .misc.scheduler import Scheduler
@@ -40,6 +40,7 @@ if TYPE_CHECKING:
from .store import StoreManager
from .supervisor import Supervisor
from .updater import Updater
from .bus import Bus
T = TypeVar("T")
@@ -88,6 +89,7 @@ class CoreSys:
self._resolution: Optional[ResolutionManager] = None
self._jobs: Optional[JobManager] = None
self._security: Optional[Security] = None
self._bus: Optional[Bus] = None
# Set default header for aiohttp
self._websession._default_headers = MappingProxyType(
@@ -352,6 +354,20 @@ class CoreSys:
raise RuntimeError("DBusManager already set!")
self._dbus = value
@property
def bus(self) -> Bus:
"""Return Bus object."""
if self._bus is None:
raise RuntimeError("Bus not set!")
return self._bus
@bus.setter
def bus(self, value: Bus) -> None:
"""Set a Bus object."""
if self._bus:
raise RuntimeError("Bus already set!")
self._bus = value
@property
def host(self) -> HostManager:
"""Return HostManager object."""
@@ -540,9 +556,14 @@ class CoreSysAttributes:
@property
def sys_core(self) -> Core:
"""Return core object."""
"""Return Core object."""
return self.coresys.core
@property
def sys_bus(self) -> Bus:
"""Return Bus object."""
return self.coresys.bus
@property
def sys_plugins(self) -> PluginManager:
"""Return PluginManager object."""