Adjust sound reload (#1531)

* Adjust sound reload & remove quirk

* clean info message

* fix hack
This commit is contained in:
Pascal Vizeli 2020-02-27 11:58:28 +01:00 committed by GitHub
parent 7e3859e2f5
commit 374bcf8073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -81,9 +81,7 @@ class Audio(JsonConfig, CoreSysAttributes):
# Run PulseAudio
with suppress(AudioError):
if await self.instance.is_running():
await self.restart()
else:
if not await self.instance.is_running():
await self.start()
# Initialize Client Template
@ -137,8 +135,12 @@ class Audio(JsonConfig, CoreSysAttributes):
async def restart(self) -> None:
"""Restart Audio plugin."""
with suppress(DockerAPIError):
_LOGGER.info("Restart Audio plugin")
try:
await self.instance.restart()
except DockerAPIError:
_LOGGER.error("Can't start Audio plugin")
raise AudioError() from None
async def start(self) -> None:
"""Run CoreDNS."""

View File

@ -145,13 +145,13 @@ class Core(CoreSysAttributes):
# Start observe the host Hardware
await self.sys_hwmonitor.load()
# Upate Host/Deivce information
self.sys_create_task(self.sys_host.reload())
self.sys_create_task(self.sys_updater.reload())
_LOGGER.info("Supervisor is up and running")
self.state = CoreStates.RUNNING
# On full host boot, relaod information
self.sys_create_task(self.sys_host.reload())
self.sys_create_task(self.sys_updater.reload())
async def stop(self):
"""Stop a running orchestration."""
# don't process scheduler anymore

View File

@ -116,6 +116,9 @@ class SoundControl(CoreSysAttributes):
# Update input
self._input.clear()
for source in pulse.source_list():
# Filter monitor devices out because we did not use it now
if source.name.endswith(".monitor"):
continue
self._input.append(
AudioProfile(
source.name,

View File

@ -133,7 +133,6 @@ class Hardware:
def audio_devices(self) -> Dict[str, Any]:
"""Return all available audio interfaces."""
if not ASOUND_CARDS.exists():
_LOGGER.info("No audio devices found")
return {}
try: