Some fun with Alexa on a Friday afternoon

You need to use the intents system as described in my original post. The only downside is it is an Alexa skill so you need a keyword (of your choice) to activate it, e.g. “home assistant”. You control the keyword and all the words after that but you have to add them all individually. So you would say something like:

Alexa, tell home assistant to open the garage door

Rather than

Alexa turn the garage door on

As you would with emulated hue.

The main docs for the intents setup are here.

Hi @aimc

I have setup everything but whenever I ask Alexa to activate something it says it couldnt find the device in my account. I was able to switch on and off my kitchen strip lights before with the emulated hue but now I cant. Also the kitchen strip lights are setup using MQTT as a switch.

Do you know what could be the problem? I have used your scenes code and set it up exactly how you described.

Thanks.

SOunds like you aren;t using the keyword correctly. You have to say something like:

“Alexa tell home assistant to turn on the kitchen linght”

Where “home assistant” is the keyword you added in the Alexa setup on Amazon;'s website.

I am using the keyword home assistant which I set up on Amazon’s website but it tells me it cant find the device in my account.

My configuration.yaml is:

alexa:
intents:
ActivateSceneIntent:
action:
service: scene.turn_on
data_template:
entity_id: scene.{{ Scene | replace(" ", “_”) }}
speech:
type: plaintext
text: >
There you go.

Sounds like your Amazon setup is incomplete - go back and check the steps in the docs I linked above. There are some steps to actually activate the skill in your Alexa app once you have created it.

Just as an aside; “Home Assistant” may be hard for Alexa to understand or parse depending on your pronunciation, location of the device (near a wall, in a room with reverb, etc.). When I set mine up, I used a simple invocation keyword that was easy to say. Something to consider.

Right so the intent schema that you provided game me errors so I used this :

{
“intents”: [
{
“intent”: “ActivateSceneIntent”,
“slots”: [
{
“name”: “Scene”,
“type”: “Scenes”
}]
}

]
}

Custom Slot types is :
Kitchen Lights On

And Sample Utterances is :
ActivateSceneIntent activate {Scene}

Thanks for pointing that out !

No problem. It wasn’t something I thought of at first but it did make a difference.

BTW, when you are posting code, it’s a good idea to use the preformatted text option to preserve your formatting. It makes it a lot easier to read and for other to see if there is a formatting error at the root of your issue.

In the forum editor, select your code block and press the button indicated in the image below:

Sure

I am using the AWS Lambda Proxy Alexa Custom Skill as I cannot set up SSL with my HA for some reason. When I try to go to the URL to call for each applicaitonID (http://IPADDRESS:8123/api/alexa?api_password=XXXX) it says 405: Method Not Allowed. Could that be a problem?

I have activated the skill in my Alexa app and can see it under “your skills”

Also under Lambda when I test my function using “Hello World” it gives me the following error:

    {
  "errorMessage": "Unexpected token ILLEGAL",
  "errorType": "SyntaxError",
  "stackTrace": [
    "Object.Module._extensions..js (module.js:416:10)",
    "Module.load (module.js:343:32)",
    "Function.Module._load (module.js:300:12)",
    "Module.require (module.js:353:17)",
    "require (internal/module.js:12:17)"
  ]
}

I am getting this error now: “errorMessage”: "Exception: TypeError: Cannot read property ‘application’ of undefined”

Can you please help?

Sorry, I’m not sure what that error means.

I am not sure what I am doing wrong as my SSL doesnt work.

Have you set up AWS Lambda?

I don’t use a Lambda proxy. Sorry.

Hi thanks for your reply.

Is there anyway that you could guide me on setting up SSL?I have followed bruh automation’s video on how to set it up but when I try to open my ha by https:// it doesn’t work.

Not sure what is wrong?

If you’re not able to reach it using https from inside your network, it could be that your router doesn’t support loopback. You can confirm that’s what’s happening by disconnecting your phone from wifi so that you’re on cell data, then try accessing HASS.

If that doesn’t work, then the error is important. Is it a connection issue or some other error…

thanks for the reply !

So I tried https://XXXX.duckdns.org:8123 from my home network and cell data and everything works well. As soon as I removed 8123 and just try https://XXXX.duckdns.org it doesn’t work. My router cannot forward port 443 to port 8123 for some reason.

Also when I try https://YOUR_HOST/api/alexa?api_password=YOUR_API_PASSWORD it fails to open any page but when I try https://YOUR_HOST:8123/api/alexa?api_password=YOUR_API_PASSWORD it says 405: Method Not Allowed.

Do you have any other ideas to get around this issue?

Thanks.

That sounds like an issue with your router configuration, not with HASS. You’ll need to get that sorted to use the Alexa component as it wants HTTPS/443. You want to have your router send all 8123 traffic to 443 on your HASS install. You’ll need to configure ports AND the destination IP address.

In which case I have to change my router as my router does not allow to send traffic from 8123 to 443!

What kind of router do you have? I didn’t realize you were using :8123 in your URL; Amazon won’t work with any ports added to the target URL.