Alexa Intents

Hi,

I created a generic Alexa intent “TurnOnIntent” which takes a device name slot. The device name slot, in the Amazon configuration, has a few valid values that have IDs associated with them. For example:

Living Room Lights ID: LIVINGROOMLIGHTS Synonym: Lights in the living room.

I expected that if I say “Turn on Living Room Lights” or “Turn on lights in the living room” i was expecting the slot value passed to HASS to be LIVINGROOMLIGHTS, instead I am getting the value that was said (which means my configuration in HASS needs to check for all the synonyms).

Am I doing something wrong or is this jus the way it is?

When making intent you define “utterances”. This is what you will say to activate it.

The intent is intended to pass value to HA which activate HA Automation.

Check utterances is correct in Amazon.
Check call to HA is correct in Amazon.
Check automation is correct in HA.

Also, Is Alexa just repeating what you say?

No its calling my intent correct, but the value of the slot is what I said and not the “mapped” ID.

If you take a look here you can see that there are three different things Alexa sends over when calling an intent:

  • The actual word uttered
  • The “slot value” which is the thing you want to be the base value, for which you have synonyms
  • The ID

From the home assistant docs:

…you can also create synonyms for slot type values, which can be used in place of the base value in utterances. Synonyms will be replaced with their associated slot value in the intent request sent to the Alexa API endpoint, but only if there are not multiple synonym matches.

So ID is not the same as slot value - your intent config in HA needs to check for the slot value.

Yea, but what I am actually seeing is that when I reference {{ slotName }} in my intent configuration it is the words uttered not the slot value OR ID. I even see this from Amazon’s testing tool.

When I test for “turn on lights in living room” (lights in living room is a synonym for living room lights with ID LIVINGROOMLIGHTS) - the JSON sent in the Amazon test tool is:

{
  "session": {
    "new": true,
    "sessionId": "SessionId.55628964-2637-4f4a-958a-a3dcb54b2735",
    "application": {
      "applicationId": "amzn1.ask.skill.d6188a62-7903-435e-b632-ff01acd5084b"
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.xxxxx"
    }
  },
  "request": {
    "type": "IntentRequest",
    "requestId": "EdwRequestId.11592acc-0258-4db3-aafd-46d8a84be69d",
    "intent": {
      "name": "TurnOnIntent",
      "slots": {
        "devicename": {
          "name": "devicename",
          "value": "lights in living room"
        }
      }
    },
    "locale": "en-US",
    "timestamp": "2017-11-22T17:40:12Z"
  },
  "context": {
    "AudioPlayer": {
      "playerActivity": "IDLE"
    },
    "System": {
      "application": {
        "applicationId": "amzn1.ask.skill.d6188a62-7903-435e-b632-xxxx"
      },
      "user": {
        "userId": "amzn1.ask.account.xxxx"
      },
      "device": {
        "supportedInterfaces": {}
      }
    }
  },
  "version": "1.0"
}

Can you share your Alexa config?

So I found this link:

https://forums.developer.amazon.com/questions/79664/entity-resolutions-missing-in-json-request.html?page=2&pageSize=10&sort=votes

Made me test on my device, and on my device it seems to map to the value properly. How can I reference the ID in my config? {{ devicename }} seems to map to the value.

Interesting regarding the testing… According to the HA docs you need to use the slot value in your config, not the ID. The ID is optional anyway and so the HA support for synonyms was designed to work only with the slot value.

Ok so to summarize:

HA config supports just the value, however when testing with Amazon’s mock testing tool (at least for me) the value = uttered words but on the device value=value.

I think I’m good to go. Thanks!