Before Home Assistant Cloud and Haaska there was the Amazon Alexa Custom Skill or Emulated Hue integration if you wanted to control your HA instance via Alexa.
Since the introduction of the Amazon Alexa Smart Home Skill which makes discovering entities and controlling them so much easier the necessity for a configurable intent based skill is less, but there are cases when it’s preferred since the smart home skill doesn’t allow querying your HA instance to find out the status of a door, or the value of a sensor.
During this time HA 0.77.0 came along and introduced the excellent updated authentication system . However the documentation for the Amazon Alexa Custom Skill seems to be stuck in the past as it still references using an
api_password
.
I’m not one to jump on the support bus early and have done extensive research on the forums, reddit and tried to troubleshoot the issue myself, but I feel there is a piece of the puzzle I’m overlooking.
These are some of the relevant topics I came across:
- How do I transition Alexa Component to use long-lived token rather than api_password?
- Help with Alexa/API
- Alexa custom (not smart home) skills
Configuration of Alexa Skill
Endpoint
- Service Endpoint Type has been set to HTTPS
-
Default Region I’ve set to
https://myhomeassistant.domain.com/api
(this used to be https://myhomeassistant.domain.com/api/homeassistant/ which returns a 404 now).
Account Linking
- Do you allow users to create an account or link to an existing account with you? = ON
- Allow users to enable skill without account linking (Recommended). = OFF
- Security Provider Information = Auth Code Grant
-
Authorization URI*:
https://myhomeassistant.domain.com/auth/authorize
-
Access Token URI:
https://myhomeassistant.domain.com/auth/token
-
Client ID*:
https://alexa.amazon.co.jp/
(since I’m from AU) - Client Secret*: random sting (since HA doesn’t check)
- Client Authentication Scheme*: Credentials in request body
- Scope: blank
- Domain List: blank
- Default Access Token Expiration Time: blank
NGINX Reverse Proxy Configuration
location /api/websocket {
proxy_pass http://localhaipaddress:8123/api/websocket;
proxy_set_header Host $host;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /api {
proxy_pass http://localhaipaddress:8123/api;
proxy_set_header Host $host;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Alexa Defined in HA Configuration
alexa:
Observations
I can successfully link the skill in the Alexa App and can see the refresh token in HA. The issue is Alexa keeps returning "There was a problem with the requested skills response."
When viewing the log of my reverse proxy I can see that when using my custom invocation name it hits HA but returns the following:
HTTP/1.1 405 Method Not Allowed
The question is, does anyone know what I and others are missing when trying to configure the Amazon Alexa Custom Skill with the updated authentication system?
Thanks in advance.