Start Conversation with TTS and start listening

I would like to start a conversation triggerd from the home automation system.
To achieve this:
1.)A message is published to hermes/tts/say
2.)After a short delay
3.)Rhasspy is waked up by publishing a message to hermes/hotword/porcupine/detected.
4.)A Session is started and an answer/Intent can be spoken

I am not really happy with the achived behavior since 4.) accepts all intents (no intent filter) and the command sequence poorly/not synchronised.

Is there a better way to achive that?

Eg. something like a command startSessionAndWakeUp (with parameters text, intentFilter, 
).

Can someone give me a few tips on this? Thanks!

1,2 and 3 can be replaced by publishing to hermes/dialogueManager/startSession
The message should contain init and siteID,

{"init":
   {
     "type":"action",
     "canBeEnqueued": false
    },
    "siteId":"default"
   }

The init object also has a intentFilter, which you can use.

See this documentation:


And
1 Like

Yes that works! Thank you very much for pointing me at this. I overlooked the passage with the type=action for the startSession command. I already tried that command before but only with type=notification


I am trying to do the same thing but i am stuck with the intent fillter. Could someone give me an example please. Here is my function what goes with intentFilter: is it the name of the intent or much more?

def startSession(cclient,intentName,saytxt):

cclient.publish("hermes/dialogueManager/startSession",

json.dumps(

    { 'init':

        {

        'type':'action',

        'canBeEnqueued': false,

        'text':saytxt,

        'intentFilter':intentName

        },

        'siteId':'default'

    }

    ))

For me this example is working:
{
“init”:
{
“text” : “Question”,
“type”: “action”,
“canBeEnqueued”: false,
“intentFilter”: [“PossibleAnswers”]
},
“siteId”: “satelitte”,
“customData”:null,
“lang”:null
}

Look how the square brackets are used in the example for the intent filter.

Thanks. Ill give it a try.

Hi, I am also trying to start a conversation using stsrtSession by using homeassistant action. Below is my automation:

alias: Rhasspy test
description: “”
trigger:

  • platform: device
    type: changed_states
    device_id: 3b8b2bdebf161a45eb77f3fdc3bddda1
    entity_id: remote.sony_kd_65x80j
    domain: remote
    condition: []
    action:
  • service: mqtt.publish
    data:
    topic: hermes/dialogueManager/startSession
    payload_template: >-
    ‘{ “siteId” : “default” , “init” : { "type ": “action”,
    “canBeEnqueued”: false, “text” : “hello” }’ }
    mode: single

I am getting this error in rhasspy
[ERROR:2022-12-08 04:44:13,942] rhasspydialogue_hermes: parse_mqtt_message (topic=hermes/dialogueManager/startSession)
Traceback (most recent call last):
File “/usr/lib/rhasspy/rhasspy-hermes/rhasspyhermes/client.py”, line 303, in parse_mqtt_message
json_payload = json.loads(payload)
File “/usr/lib/python3.7/json/init.py”, line 348, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.7/json/decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.7/json/decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Am i missing something in the payload?

Hi !
It’s old but here what i put in an automation and working fine :

  • service: mqtt.publish
    data:
    payload: ‘{ “init”: { “type”: “notification”, “text”: “Un appareil a Ă©tĂ© mis en charge” }, “siteId”: “maitre” }’
    topic: hermes/dialogueManager/startSession