Trigger after wake word?

The wake word works for me even with moderate music volume, however the recording is not stopped after my command, because of the background music. I’d like to mute music just after the wake word detection.

Is there a way to trigger something after wake word detection ? Maybe on MQTT (using Mosquitto as an external MQTT) ? Or even better trigger more directly a Home Assistant intent_script ?

I’m using porcupine.

After Wakeword is recognized
topic: hermes/dialogueManager/sessionStarted
After session is finished
topic: hermes/dialogueManager/sessionEnded

I use it to mute and unmute TV controlled by Logitech Hub.
I started with “nodered” and now “homeassistant”. If you need help, I will give you the code.

Hope that helps

In the section Text to seech / Kaldi, you can play with some settings.
I changed
silence rec to vad+max current
max current energy 0.85
max duration 8 sec

Thanks to you both!!!

So I’ll be taking Kaykoch’s path. I’ve installed MQTT Explorer and I see that I even can have the client that has detected the hotword, which means I should be able to mute just the snapcast client that is next to the rhasspy satellite which detected the wakeword, instead of in the whole house!!!

The big issue i’m seeing here is that “hermes/dialogueManager/sessionEnded” does not appear for some time - on my setup its 30 seconds. So if using that sequence to mute music etc then it goes quiet for some time.

Hi Dave,
sessionEnded will be used as topic, when the session has ended :wink:
If you don’t end it by yourself, it will be ended after 30 seconds.

To end it in time, you should:

  1. Start the session with hotword
  2. Save the sessionID for that session (in NodeRed use a global variable)
  3. Mute the TV (hermes/dialogueManager/sessionStarted)
  4. Speak your sentence
  5. finish the session (hermes/dialogueManager/endSession)
  6. Unmute the TV (hermes/dialogueManager/sessionEnded)

This will end the session, identified by the sessionID

   topic: hermes/dialogueManager/endSession
            "siteId": "{{siteId}}",
            "text":"{{text}} ",

sitIeId: The Satellite, which started the session
sessionId: The saved SessonId from (above #2)
text: Optional text, that should be spoken

Here some examples for Homeassistant

Example 1: Event (DENON_mute, above #3 / #6)

  - id: DENON_mute
    alias: DENON_mute
    - platform: mqtt
      topic: hermes/dialogueManager/sessionStarted
    - data_template:
        is_volume_muted: true
      entity_id: media_player.denon_avr_x2400h
      service: media_player.volume_mute
    mode: single

Example 2: Event (getTime, above #4)

    id: 'rhasspy_GetTime'
    alias: rhasspy_GetTime
    - platform: event
      event_type: rhasspy_GetTime
    - service: script.turn_on
          entity_id: script.script_talk_to_satellite
            siteId: >
            sessionId: >
            text: >
              Es ist {{ now().strftime('%H : %Mh') }}   
    mode: single

The script to finish session: (above #5)

    alias: script_talk_to_satellite
    - service: mqtt.publish
        topic: hermes/dialogueManager/endSession
        payload_template: >
            "siteId": "{{siteId}}",
            "text":"{{text}} ",

In Nodered:

Example to get relevant Infos

  1. use a mqtt In-Node to get Slots, Intent-name, SessionId
  2. save the SessionId
  3. do the Indent-Handling (+ create the Answer)
  4. use a mqtt Out-node to finish Session and say answer

I hope , that helps.

Brilliant :slight_smile:
I’m in Node Red but the bit quoted answered everything. I never pictured it as a full two-way conversation before and i had the end-session step missing.

I now have a good solid block of mqtt conversation sequences and its working far better.