mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-02 19:08:54 +02:00
Add wake word phrase to voice assistant start command (#6290)
This commit is contained in:
@@ -42,6 +42,8 @@ CONF_AUTO_GAIN = "auto_gain"
|
||||
CONF_NOISE_SUPPRESSION_LEVEL = "noise_suppression_level"
|
||||
CONF_VOLUME_MULTIPLIER = "volume_multiplier"
|
||||
|
||||
CONF_WAKE_WORD = "wake_word"
|
||||
|
||||
|
||||
voice_assistant_ns = cg.esphome_ns.namespace("voice_assistant")
|
||||
VoiceAssistant = voice_assistant_ns.class_("VoiceAssistant", cg.Component)
|
||||
@@ -285,6 +287,7 @@ VOICE_ASSISTANT_ACTION_SCHEMA = cv.Schema({cv.GenerateID(): cv.use_id(VoiceAssis
|
||||
VOICE_ASSISTANT_ACTION_SCHEMA.extend(
|
||||
{
|
||||
cv.Optional(CONF_SILENCE_DETECTION, default=True): cv.boolean,
|
||||
cv.Optional(CONF_WAKE_WORD): cv.templatable(cv.string),
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -293,6 +296,9 @@ async def voice_assistant_listen_to_code(config, action_id, template_arg, args):
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
if CONF_SILENCE_DETECTION in config:
|
||||
cg.add(var.set_silence_detection(config[CONF_SILENCE_DETECTION]))
|
||||
if wake_word := config.get(CONF_WAKE_WORD):
|
||||
templ = await cg.templatable(wake_word, args, cg.std_string)
|
||||
cg.add(var.set_wake_word(templ))
|
||||
return var
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user