Hi, been using Dialogflow intent scripts for a while now and they work well and are quite speedy. I have a particular intent, where I would like to delay the speech response for a few seconds while a sensor value gets returned…
I tried the async_action: False
parameter which as I read it is supposed to wait until the script is complete before returning a response. This feature doesn’t seem to work in my setup.
It takes a few seconds for the item to be queued to my player and I was hoping to respond back with the queued item. Running 0.84.1 and my intent look something like this:
lms_dialog_play_intent:
speech:
text: 'Playing {{state_attr("media_player.kitchen", "media_title")}} on the player'
async_action: False
action:
- service: input_text.set_value
data_template:
entity_id: input_text.lms_command_intent
value: "{{lms_command}}"
# Set player
- service: input_text.set_value
data_template:
entity_id: input_text.lms_p3
value: "{{lms_player}}"
- service: input_select.select_option
data_template:
entity_id: input_select.lms_player
option: >
{% if (states.input_text.lms_p3.state == '') %} {{states.input_select.lms_player.state}}
{% else %} {{states.input_text.lms_p3.state}} {% endif %}
# Set shuffle
- service: input_text.set_value
data_template:
entity_id: input_text.lms_p3
value: "{{lms_shuffle}}"
- service_template: >
{% if ((states.input_text.lms_p3.state == '') and (states.input_boolean.lms_shuffle.state == "on")) %} input_boolean.turn_on
{% elif ((states.input_text.lms_p3.state == '') and (states.input_boolean.lms_shuffle.state == "off")) %} input_boolean.turn_off
{% elif (states.input_text.lms_p3.state == 'on') %} input_boolean.turn_on
{% elif (states.input_text.lms_p3.state == 'off') %} input_boolean.turn_off
{% endif %}
entity_id: input_boolean.lms_shuffle
# Set artist
- service: input_text.set_value
data_template:
entity_id: input_text.lms_artist
value: "{{lms_artist}}"
# Set album
- service: input_text.set_value
data_template:
entity_id: input_text.lms_album
value: "{{lms_album}}"
# Set song
- service: input_text.set_value
data_template:
entity_id: input_text.lms_song
value: "{{lms_song}}"
# Set playlist
- service: input_text.set_value
data_template:
entity_id: input_text.lms_playlist
value: "{{lms_playlist}}"
### check lms_command and call appropriate script
- service: script.turn_on
data_template:
entity_id: >-
{% if ((lms_command == "play song") and (states.input_select.lms_source.state == "lms")) %}
script.lms_cmd_play_song
{% elif ((lms_command == "play song") and (states.input_select.lms_source.state == "spotify")) %}
script.lms_cmd_play_song_spot
{% elif ((lms_command == "play playlist") and (states.input_select.lms_source.state == "lms")) %}
script.lms_cmd_play_playlist
{% elif ((lms_command == "play playlist") and (states.input_select.lms_source.state == "spotify")) %}
script.lms_cmd_play_playlist_spot
{% elif ((lms_command == "play artist") and (states.input_select.lms_source.state == "lms")) %}
script.lms_cmd_play_artist
{% elif ((lms_command == "play artist") and (states.input_select.lms_source.state == "spotify")) %}
script.lms_cmd_play_artist_spot
{% elif ((lms_command == "play album") and (states.input_select.lms_source.state == "lms")) %}
script.lms_cmd_play_album
{% elif ((lms_command == "play album") and (states.input_select.lms_source.state == "spotify")) %}
script.lms_cmd_play_album_spot
{% else %}
script.lms_do_nothing
{% endif %}
As always, any help would be appreciated. Ynot.