#Convert [working] Alexa Skills to HA

1 messages · Page 1 of 1 (latest)

loud junco
#

I have several Alexa skills that I have created over the years to "Tell the house" or "Tell the thermostat", that execute intent scripts to do things in Home Assistant.

I'm trying to convert those to work locally with HA using Assist and Intents, but keep running into a couple of issues on the first (and probably easiest) of the intents.

First, I keep getting "no_intent_match" for one of my sentences (I want to watch TV) - even after copying/pasting the sentence directly from the Debug Assistant Speech-to-text output. But the other sentence for the same intent is working. Any ideas on how to resolve this?

custom_sentences/en/WatchTV.yaml:

language: en
intents:
  WatchTv:
    data:
      - sentences:
          - I want to watch TV                # this doesn't work
          - (I'm | I am) going to watch TV    # this does work

Second, I'm trying to reuse the Alexa intent scripts for the local intents (the actions are working for both), but Alexa requires the "type:ssml" and that the text be wrapped in <speak></speak> tags. Is there any way to use the same intent script for both Alexa and HA intents and get the text to work for both?

intent script output that works for Alexa:

WatchTv:
  action:
    - service: ... stuf happens here...
  speech:
    type: ssml
    text: >
      {%- if (not area is defined) or (area == '') -%}
      {%-   set where = 'living room' -%}
      {%- else -%}
      {%-   set where = area -%}
      {%- endif %}
        <speak>Powering up the home theater in the {{where}}</speak>
raw maple
#

When you added the new sentence did you reload intent script and conversation from dev tools?

orchid torrent
#

Also don't use capital letters in sentences. Be as generic as possible. And check in debug window for assistant, what did it actually recognize.

loud junco
#

I've removed capitalization from my sentences, then reloaded conversation and intent scripts from dev tools again - have been doing that with every change.

This is what I'm seeing in the debug window:

I'm going to watch TV - works:

Natural Language Processing       0.02s 
Engine      conversation.home_assistant
Language                             en
Input            I'm going to watch TV.
Response type               action_done
Prefer handling locally           false
Processed locally                  true

I want to watch tv - doesn't work:

Natural Language Processing       0.67s
Engine      conversation.home_assistant
Language                             en
Input               I want to watch TV.
Response type                     error
Error code              no_intent_match
Prefer handling locally           false
Processed locally                  true
raw maple
#

Maybe put your defined sentences in quotes?

loud junco
#

Just tried that - no change with or without quotes.

raw maple
#

Or maybe for some weird reason there could be an extra space or some hidden character

loud junco
#

I've copied and pasted the input text from the debug window into the sentence, and it still doesn't work - still getting error code no_intent_match - but only for that sentence.

#

I've even tried changing the order of the sentances so that one is second and the working one is first - no change.

raw maple
#

Have you tried changing it to some other sentence just to see if that works?

loud junco
#

I updated it to this:

language: en
intents:
  WatchTv:
    data:
      - sentences:
          - "(i | i'm | i am) (want to | going to | gonna) watch (tv | youtube)"

the "going to" or "gonna" watch "tv" or "youtube" work, but "want to" always still fails with "want to".

raw maple
#

Aah i see why

loud junco
#

I also just tried this:

language: en
intents:
  WatchTv:
    data:
      - sentences:
          - "(i'm | i am) (going to | gonna | gunna) watch (tv | youtube)"
          - "i (desire | want) to watch tv"

"I desire to watch tv" works, but "i want to watch tv" still fails with no_intent_match:

from debug:

Input        I desire to watch TV.
Response type          action_done
Input          I want to watch TV.
Response type                error
Error code         no_intent_match

There must be something weird going on with "want"

raw maple
#

"i want" is a skip phrase

#

Meaning the intent parser ignores that when it sees it in a sentence

loud junco
#

I looked through that file earlier, but didn't make it down to the skip_words. I assume there's no way to un-skip words?

raw maple
#

Not that i have heard of

#

Could just make the sentence "[to] watch tv"

#

Then that would work i think

loud junco
#

That seems way to easy 😂.

In the spirit of continuing to learn from this issue - I'm wondering about making the "want" a list - then change "want" to "desire"???

raw maple
#

Not sure what you mean there 😅

#

The way you have it now it takes one of want or desire, basically working like a list

loud junco
#

make a list for "want" (similar to the list for temperature_units in _common.yaml) - and in the values change in: want to out: desire

raw maple
#

Not sure that would work, and for really necessary

#

So skip word can be spoken, they just have no bearing on intent

#

So like you can say "turn on the lights"

#

If you say "i want to turn on the lights" that still works even though the intent doesn't have "i want to" as part of it

#

Usually using the in and out is for value conversion

#

Like i say on and i want it to output as true to fill some argument to a script for instance

loud junco
#

Ok - easy solution it is then - thank you for the help.

loud junco
# raw maple Could just make the sentence "[to] watch tv"

I've confirmed that using [to] watch tv as the sentence fixed the issue.

As for the second issue - I don't think what I'm trying to do is possible - so I'm updating/prefixing my Alexa skills (and intent Scripts) with Alexa and duplicating for local assist sentences.

modest canyon
mighty iris
#

Thanks! Yea, I feel this should probably come out. It does indeed seem significant in a sentence in a way others like “could you” do not.

#

Or, maybe. I guess “I want to” could basically be a prefix to any command. “I want to turn on the living room lights”… or, in this case, “watch TV”.

#

However there is still going to be confusion if they are removed and people are writing custom sentences where the skip words are applied but unknown to them.

#

Perhaps, there should be rather a change in hassil to attempt matching with and without?

modest canyon
#

We can announce it as a breaking change in the next HA release

mighty iris
#

I feel like this is a case of either way it breaks someone’s workflow. Best option would be to match both.

#

Or, do not apply skip words when matching sentence triggers, only intents.

modest canyon
mighty iris
#

Since I, as a user, would expect a sentence I’m explicitly entering to be matched literally.

mighty iris
#

There is no “clean” fix.

modest canyon
mighty iris
#

Oh… this is using custom sentences rather than an automation. My mistake.

#

How does this apply to an LLM then? It seems to me if there is a sentence file that is going to be impacted by all the common expansions and skip words, it would be appropriate to “resolve” this as done by making the sentence match “watch TV”, which is command language.

#

I think though that “I want” should probably expand to “I want to” as that really is the prefix. “I want” is too short and doesn’t really capture a command prefix. For example in “I want pizza”, “pizza” is not a command.

loud junco
#

the "I want" skip word did really throw me for a loop and I didn't think to look for it in the _common.yaml file even though I was poking around in there previously.

Would it be possible to add something to the Debug output to show when a skip word is used/triggered/ignored or a conversion is performed due to a list in/out value? I feel like that would have helped with all of the confusion.

Please let me know if you still want me to add an issue on the intents repo.

mighty iris
#

That’s a good thought. Perhaps showing what was actually matched against, so you’d see the sentence minus the skip words.

#

That would at least save some time debugging.

loud junco
#

Agreed - showing what STT understood and what was used to match after any expansion rules/lists/skip words would be very helpful.