Merge branch 'main' into feature/add-docker

This commit is contained in:
Florian Asche authored and GitHub committed 2026-02-08 17:23:39 +01:00
commit 761bcea5ac
5 files changed
+96 -68

No files matched your search

+25 -13
View File
@@ -33,7 +33,7 @@ _SOUNDS_DIR = _REPO_DIR / "sounds"
async def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--name", required=True)
parser.add_argument("--name")
parser.add_argument(
"--audio-input-device",
help="soundcard name for input device (see --list-input-devices)",
@@ -82,17 +82,20 @@ async def main() -> None:
"--timer-finished-sound", default=str(_SOUNDS_DIR / "timer_finished.flac")
)
parser.add_argument(
"--processing-sound", default=str(_SOUNDS_DIR / "processing.wav"),
help="Short sound to play while assistant is processing (thinking)"
"--processing-sound",
default=str(_SOUNDS_DIR / "processing.wav"),
help="Short sound to play while assistant is processing (thinking)",
)
parser.add_argument(
"--mute-sound", default=str(_SOUNDS_DIR / "mute_switch_on.flac"),
help="Sound to play when muting the assistant"
"--mute-sound",
default=str(_SOUNDS_DIR / "mute_switch_on.flac"),
help="Sound to play when muting the assistant",
)
parser.add_argument(
"--unmute-sound", default=str(_SOUNDS_DIR / "mute_switch_off.flac"),
help="Sound to play when unmuting the assistant"
)
"--unmute-sound",
default=str(_SOUNDS_DIR / "mute_switch_off.flac"),
help="Sound to play when unmuting the assistant",
)
#
parser.add_argument("--preferences-file", default=_REPO_DIR / "preferences.json")
#
@@ -106,8 +109,10 @@ async def main() -> None:
"--port", type=int, default=6053, help="Port for ESPHome server (default: 6053)"
)
parser.add_argument(
"--enable-thinking-sound", action="store_true", help="Enable thinking sound on startup"
)
"--enable-thinking-sound",
action="store_true",
help="Enable thinking sound on startup",
)
parser.add_argument(
"--debug", action="store_true", help="Print DEBUG messages to console"
)
@@ -134,6 +139,9 @@ async def main() -> None:
logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)
_LOGGER.debug(args)
if not args.name:
parser.error("the following arguments are required: --name")
args.download_dir = Path(args.download_dir)
args.download_dir.mkdir(parents=True, exist_ok=True)
@@ -243,7 +251,7 @@ async def main() -> None:
timer_finished_sound=args.timer_finished_sound,
processing_sound=args.processing_sound,
mute_sound=args.mute_sound,
unmute_sound=args.unmute_sound,
unmute_sound=args.unmute_sound,
preferences=preferences,
preferences_path=preferences_path,
refractory_seconds=args.refractory_seconds,
@@ -251,7 +259,7 @@ async def main() -> None:
)
if args.enable_thinking_sound:
state.save_preferences()
state.save_preferences()
process_audio_thread = threading.Thread(
target=process_audio,
@@ -371,7 +379,11 @@ def process_audio(state: ServerState, mic, block_size: int):
if state.stop_word.process_streaming(micro_input):
stopped = True
if stopped and (state.stop_word.id in state.active_wake_words) and not state.muted:
if (
stopped
and (state.stop_word.id in state.active_wake_words)
and not state.muted
):
state.satellite.stop()
except Exception:
_LOGGER.exception("Unexpected error handling audio")