Snips.say delay because site "x" is busy

#1

Hi,

I would like to ask Snips what temperature is inside/outside my house, so i wrote intent script:

temp:
  action:
  - service: script.temp_in_out
    data_template:
      site_id: "{{ site_id }}"
      in_out: "{{ in_out }}"

Script temp_in_out looks like this:

temp_in_out:
  alias: Temp in/out
  sequence:
  - alias: ''
    data_template:
      site_id: '{{ site_id }}'
      text: >
        {% if in_out == 'in' %}
            Temperatura w mieszkaniu wynosi {{ states('sensor.mitemp_bt_temperature') | round(0) }} stopni Celsjusza
        {% else %}
            Temperatura na zewnątrz wynosi {{ state_attr('weather.dark_sky', 'temperature') | round(0) }} stopni Celsjusza
        {% endif %}
    service: snips.say

The problem is that after asking Snips about temperarue, there is a 5-6 secons delay before he starts to speak. In syslog i see:

May  6 19:44:23 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Site [room]: reset site -> turn off ASR and turn off Hotword
May  6 19:44:23 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Session [6d5c723a-62af-46be-9d90-9417f7eb4829]: The session has been created because the site "room" is free
May  6 19:44:24 raspberrypi snips-tts[669]: WARN:snips_tts_hermes: Received a "play finished" message from audio server with an unknown id '972b2348-849d-43a7-849d-ac56af2b0f9d'. It could be normal if you have more than one audio server.
May  6 19:44:24 raspberrypi snips-asr-google[1221]: INFO:snips_asr_google_lib::google_auth: Connecting using service account file "/usr/share/snips/googlecredentials.json"
May  6 19:44:28 raspberrypi snips-tts[669]: WARN:snips_tts_hermes: Received a "play finished" message from audio server with an unknown id '2a6bbf4f-cdd3-464f-8bb9-7d9e80555210'. It could be normal if you have more than one audio server.
May  6 19:44:28 raspberrypi hass[28508]: 2019-05-06 19:44:28 INFO (MainThread) [homeassistant.helpers.intent] Triggering intent handler <ScriptIntentHandler - temp>
May  6 19:44:28 raspberrypi hass[28508]: 2019-05-06 19:44:28 INFO (MainThread) [homeassistant.helpers.script] Script Intent Script temp: Running script
May  6 19:44:28 raspberrypi hass[28508]: 2019-05-06 19:44:28 INFO (MainThread) [homeassistant.helpers.script] Script Intent Script temp: Executing step call service
May  6 19:44:28 raspberrypi hass[28508]: 2019-05-06 19:44:28 INFO (MainThread) [homeassistant.helpers.script] Script Temp in/out: Running script
May  6 19:44:28 raspberrypi hass[28508]: 2019-05-06 19:44:28 INFO (MainThread) [homeassistant.helpers.script] Script Temp in/out: Executing step
May  6 19:44:28 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Session [0b950818-dd67-4542-bf2f-9a49305b693c]: The session has been enqueued because the site "room" is busy
May  6 19:44:33 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Session [6d5c723a-62af-46be-9d90-9417f7eb4829]: closing session which was active: Timeout
May  6 19:44:33 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Site [room]: reset site -> turn off ASR and turn off Hotword
May  6 19:44:33 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Session [0b950818-dd67-4542-bf2f-9a49305b693c]: dequeue and start session because the site "room" is now free
May  6 19:44:39 raspberrypi snips-dialogue[654]: WARN:snips_dialogue_lib::coordinator::coordinator: No Session found for this response: AudioPlayFinished(AudioFinishedPayload)
May  6 19:44:39 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Session [0b950818-dd67-4542-bf2f-9a49305b693c]: closing session which was active: Nominal
May  6 19:44:39 raspberrypi snips-dialogue[654]: INFO:snips_dialogue_lib::coordinator::coordinator: Site [room]: reset site -> turn off ASR and turn on Hotword

My question is: why site “room” is busy when intent script is recieved? How can I prevent it being busy?

#2

There is no need to call a separate script. The issue is a session is created when you ask the temperature, and that session is sent to the snips component which can answer with text. Instead you call a script, but that script has to start a new session to send the text so it has to wait for the initial session to time out.

You might be able to just put your text in the intent script but I am thinking it may not have the in_out variables set at that point, would need to test.

But you should be able to end the initial session right away by just adding empty text for snips to send. So like this:

temp:
    speech:
      text: ''
  action:
  - service: script.temp_in_out
    data_template:
      site_id: "{{ site_id }}"
      in_out: "{{ in_out }}"

The ‘’ may not work, try something like a space or period in that case.

#3

@tschmidty Thank you very much!