Voice commands. AI enhanced

(quick write up. got a request on facebook)

If you (like me) are in making your voice automation’s easier and use an automation for everything. AND you have AI. your doing it wrong.

If you make the automation trigger a script. you can explain the script to the AI prompt. using the script when failing back to AI if you make a speech trigger mix up.

call a script in a automation and use the response_variable for the speech response.

actions:
  - action: script.play_music
    metadata: {}
    data:
      searchfield: |
        {{ trigger.slots.search}}
      device_id: |
        {{ trigger.device_id}}
    response_variable: output
  - set_conversation_response: "{{output.value}}"

and use a variable and the stop action to send the speech responce to the automation.

      - variables:
          response: |
            {{ {'value': 'task compleated' } }}
      - stop:finished
        response_variable: response

Now if you enable the script for the assist.
you can tell the AI how and when use the script.

for any music request run the script start_music with arguments 
search: <artist,podcast,radio station>
locatie: <room>

Note:
you can also use this to extend the knowledge of the AI with out putting everything static in the prompt

the script list_artist returns a list of available artists and radio stations

where the script list_artist teturns a json with all my artists and radio stations

1 Like