Using MQTT message to wakeup

i’ve chosen wake word setting to be “Wake up on MQTT message”, but publishing to “hermes/hotword/default/detected” topic doesn’t wake it up - is there anything else i need to configure to make it work?

What is you payload?

tried with no payload - but just tried the following:
{“siteId”: “rhasspy”,“modelId”:“2”,“modelVersion”: “1.0”,“modelType”:“personal”,“currentSensitivity”:“0.5”}

siteid is the one taken from rhasspy settings under MQTT settings - all others were just invented - not sure if they are correct

There should be a payload with these values:

  • siteId
  • modelId
    *modelVersion
  • modelType
  • currentSensitivity

Also, sessionId and sendAudioCaptured might be needed, not sure

When I do a “real” wakeword detection, this is what is posted on my Pre 2.5 Rhasspy

{“modelId”: “snowboy”, “modelVersion”: “”, “modelType”: “personal”, “currentSensitivity”: 0.5, “siteId”: “matrixvoice”, “sessionId”: “”, “sendAudioCaptured”: null}

tried both but didn’t work. should i use a different nodelId or something else?

{“siteId”: “rhasspy”,“modelId”:“snowboy”,“modelVersion”: “”,“modelType”:“personal”,“currentSensitivity”:0.5}

and
{“siteId”: “rhasspy”,“modelId”:“snowboy”,“modelVersion”: “”,“modelType”:“personal”,“currentSensitivity”:0.5, “sessionId”: “”, “sendAudioCaptured”: null}

I’ve open the code to inspect what is going on. This is the listener method from “wake.py” of rhasspy:

    def in_listening(self, message: Any, sender: RhasspyActor) -> None:
        """Handle messages in listening state."""
        if isinstance(message, MqttMessage):
            if message.topic == self.wake_topic:
                # Check site ID
                payload = json.loads(message.payload.decode())
                payload_site_id = payload.get("siteId", "")
                if payload_site_id not in self.site_ids:
                    self._logger.debug(
                        "Got detected message, but wrong site id (%s)", payload_site_id
                    )
                    return

                # Pass downstream to receivers
                self._logger.debug("Hotword detected (%s)", self.wakeword_id)
                result = WakeWordDetected(self.wakeword_id)
                for receiver in self.receivers:
                    self.send(receiver, result)
        elif isinstance(message, StopListeningForWakeWord):
            if message.clear_all:
                self.receivers.clear()
            else:
                try:
                    self.receivers.remove(message.receiver or sender)
                except ValueError:
                    pass

            if not self.receivers:
                self.transition("loaded")
        elif isinstance(message, PauseListeningForWakeWord):
            self.transition("paused") 

The “siteid” is the first thing to be inspected when a message is received. In any case whether it is correct or not - a log message should be written:

	self._logger.debug("Got detected message, but wrong site id (%s)", payload_site_id

Or

	self._logger.debug("Hotword detected (%s)", self.wakeword_id)

As I am sending payload “{“siteId”: “rhasspy”}” to “hermes/hotword/default/detected” should be enough to trigger a log entry in rhasspy web ui -> Log tab, but the log shows nothing when I publish this.

So next thing I thought is maybe MQTT server configuration is wrong.

In settings tab, MQTT is marked green and enabled so seems right. Next thing I did is to see if I get an intent published to the MQTT server when I give a voice command. “Publish intent over MQTT” is checked and I used the “Wake” button on top right to trigger the wakeup with a recognized voice command and voila - an intent gets published to “hermes/intent/#” so MQTT server connection works good.

I’m using MQTT.fx to publish/subscribe these messages.

So why am I not seeing the any log when publishing {“siteId”: “rhasspy”} to hermes/hotword/default/detected?

In the topic hermes/hotword/default/detected The word default is the siteId.

Use hermes/hotword/rhasspy/detected if rhasspy is your siteId.

from mosquitto log - this is the output i’m getting when restarting rhasspy service:

1585896081: New client connected from 172.17.0.2 as auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (p2, c1, k60).
1585896081: No will message specified.
1585896081: Sending CONNACK to auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (0, 0)
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/HermesMqtt', ... (9 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/PyAudioRecorder', ... (7 bytes))
1585896081: Received SUBSCRIBE from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37
1585896081: 	hermes/hotword/default/detected (QoS 0)
1585896081: auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 0 hermes/hotword/default/detected
1585896081: Sending SUBACK to auto-E9E61940-91B5-0C82-5362-3B614D5C9B37
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/APlayAudioPlayer', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/PocketsphinxSpeechTrainer', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/FuzzyWuzzyIntentTrainer', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/PhonetisaurusPronounce', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/PicoTTSSentenceSpeaker', ... (5 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/PicoTTSSentenceSpeaker', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/HermesWakeListener', ... (6 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/HermesWakeListener', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/WebrtcvadCommandListener', ... (6 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/WebrtcvadCommandListener', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/HomeAssistantIntentHandler', ... (7 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/FuzzyWuzzyRecognizer', ... (6 bytes))
1585896081: Received PUBLISH from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37 (d0, q0, r0, m0, 'rhasspy/en/transition/FuzzyWuzzyRecognizer', ... (7 bytes))

from the logs you can see the following:
1585896081: Received SUBSCRIBE from auto-E9E61940-91B5-0C82-5362-3B614D5C9B37
1585896081: hermes/hotword/default/detected (QoS 0)

so the topic it subscribes to is definitely “hermes/hotword/default/detected”

Ok I was completely wrong in my previous post… I’ve checked the Hermes doc and the default is the wakewordId not the siteId. I mixed up with audioServer/siteId/playBytes topic. Sorry about that.

When you publish a message on hermes/hotword/default/detected using MQTT.fx, do you see your message published in the mosquito logs ?

Since Rhasspy subscribes to the correct topic and it looks like it is working for other users, the only issue I could imagine is that your message is not published on the correct broker (as the payload mentioned above looks correct).

Also which version of Rhasspy are you using?

yes - i can see the message being published - i only have one MQTT broker so no way it could be using another one.
in the meantime i found another solution - it is possible to wake it up using a POST http call to http://[serverip]:12101/api/listen-for-command

still curious though why MQTT publish isn’t being processed by rhasspy

Hey ^^

I’m testing Rhasspy 2.5 on Docker Compose.

Opening MQTT port let me wake up the ASR via hermes.
Just add - “12183:12183” to the ports section of your docker-compose.yml
( https://pastebin.com/JMW4SYgU )

Then you can publish on hermes to wake up…
mosquitto ex :

mosquitto_pub -h localhost -p 12183 -t ‘hermes/hotword/default/detected’ -m '{“siteId”:“your_site_id”,“modelId”:“null”}'

Another test with python3 :
( https://pastebin.com/K01T6cq6 )

For Rhasspy setting :
MQTT - internal
Wake Word - Hermes MQTT
Dialogue Management (needed for this to work) - Rhasspy
(saw in log : [WARNING:2020-06-14 09:44:46,151] rhasspyserver_hermes: Dialogue management is disabled. ASR will NOT be automatically enabled. )

Have fun ^^

1 Like