Home Assistant Assist through Alexa (skill)

Home Assistant Assist through Alexa (skill)

I’d like to share a project with you.

It’s a skill that allows you to interact with Home Assistant Assist, Generative IA integrations and enable to open the HA dashboard on a Echoshow device.

There are two versions of the same skill:

Alexa hosted, is an version easier and faster to install, but for use with Assist (pure) or AI (with simplified prompts and easy commands). If you are experiencing timeouts on commands, try the AWS hosted version…

AWS hosted, takes a little longer time to install, but does not have Alexa’s 8-second limitation, works with asynchronous calls and uses Account Linking to obtain the Home Assistant access token. This version allows you to use integrations with AI, even slower and more complex models, such as the “Extended OpenAI” integration.

I hope the skill is useful for you, as it is for me.
I’ve been using it for a while now in my house and it works great.
I created routines in Home Assistant and Node-RED to automatically start the skill under certain conditions when I enter a certain room, or when I turn on a specific device, for example, and it works fine.

Home Assistant Skill (Alexa Hosted)

Home Assistant Skill (AWS Hosted)

Special thanks to @rodrigocoelho .

6 Likes

Ótimas melhorias. Parabéns.

1 Like

Hi @fabianosan

This works really well. Thanks for making this.

I’m sure a made a feature request a long time ago suggesting that this should be part of the official Home Assistant Alexa skill.

2 Likes

I just updated the version, with the following changes:

  • Handling of keywords to exit or close the dialog and exit the skill.
  • Refactoring of the code to be as close as possible to the version (AWS hosted) and facilitate the maintenance of both versions.
  • Now only the HA URL and the token are mandatory settings, the rest is optional.
  • Improvement in the handling of HA API responses.

I must be doing something wrong, I’ve followed the instructions (I assume I can use my locale and not : * Choose a primary locale: Portuguese (BR))

Here is the end of the request :

	"request": {
		"type": "IntentRequest",
		"requestId": "amzn1.echo-api.request.ee4bef94-20a3-4c09-a4a1-d50e9e6db8a5",
		"locale": "en-GB",
		"timestamp": "2024-10-24T09:43:40Z",
		"intent": {
			"name": "GptQueryIntent",
			"confirmationStatus": "NONE",
			"slots": {
				"query": {
					"name": "query",
					"value": "add sausages to the shopping list",
					"resolutions": {
						"resolutionsPerAuthority": [
							{
								"authority": "AlexaEntities",
								"status": {
									"code": "ER_SUCCESS_NO_MATCH"
								}
							}
						]
					},
					"confirmationStatus": "NONE",
					"source": "USER",
					"slotValue": {
						"type": "Simple",
						"value": "add sausages to the shopping list",
						"resolutions": {
							"resolutionsPerAuthority": [
								{
									"authority": "AlexaEntities",
									"status": {
										"code": "ER_SUCCESS_NO_MATCH"
									}
								}
							]
						}
					}
				}
			}
		}
	}
}

…and here is the response :

{
	"body": {
		"version": "1.0",
		"response": {
			"outputSpeech": {
				"type": "SSML",
				"ssml": "<speak>Sorry, I couldn't process your request.</speak>"
			},
			"reprompt": {
				"outputSpeech": {
					"type": "SSML",
					"ssml": "<speak>Anything else?</speak>"
				}
			},
			"shouldEndSession": false,
			"type": "_DEFAULT_RESPONSE"
		},
		"sessionAttributes": {},
		"userAgent": "ask-python/1.19.0 Python/3.8.19"
	}
}

I have tried with all my conversation agents - doesn’t work with AI or the basic Assist. Any pointers?

Which version of the skill did you use? Alexa Hosted or AWS Hosted?

And what language are you using in your Home Assistant Assist?

From what I can see in your log, your Alexa language is “en-GB”, right? You need to create the skill in the language of your Alexa account.

Alexa Hosted. I’m in the UK - so en-GB would be the correct locale. My IAM stuff is “London”.

Yes, is your Amazon accoun language.
Post here your config.cfg, please mask the root path and the token.

home_assistant_url=https://xxx.xxx.com/api/conversation/process
home_assistant_token=<redacted>
home_assistant_agent_id=conversation.home_assistant
home_assistant_language=en-GB

Blockquote
home_assistant_url=https://xxx.xxx.com/api/conversation/process

Are you using the last version? If yes, this configuration has been changed.
Try only the home assistant root path, like:

home_assistant_url=https://xxx.xxx.com

Note: Try to recreate the skill from zero.

That’s the puppy :slight_smile:

All working now - thank you so much!

1 Like

demorei um pouco para conseguir mais o tutorial nao foi dificil foi mais erro meu com a OpenAI, agora consigo comandos consecutivos e realmente inteligente, a alexa nao sabia ligar mais de um dispositivo inteligente, este ja nem sei se tem limites, e depois so mandei desligar o que tinha ligado nem citei nomes, e pronto desligou tudo.

@fabianosan

Would it be possible to have something similar for the Echo Dot devices?

It works for all Alexa devices.

2 Likes

Blockquote
Would it be possible to have something similar for the Echo Dot devices?

But it works with echo dot.
At least I tested it here with the 5th generation and it worked perfectly.
It just doesn’t open the dashboard, because it doesn’t have a screen, lol

works like a charm, thanks for that! I have set it up in Alexa.

You said you have it started in routines, in my routines it’s not showing under “my skills”.
Is it maybe needed to use the AWS or publish the skill to see it in routines?

No, I’m start through Alexa Media Player in Home Assistant and Node-RED.

Hi,
In what way you can interact with Home Assisant Assist ? Could you give some use cases or examples ?
Thanks a lot.

Is almost like this:
Talking with Home Assistant - get your system up & running - Home Assistant

But through Alexa device.

And with IA integrated to HA Assist, you can experience something like Google Home with Gemini IA has been done recently, but through Alexa and Home Assistant.

2 Likes

Hey ! I’ve tried a bit and it seems promising. I’m using Alexa Hosted.

I have a problem with the French language. Any accent or special characters in the response is deleted like in this log (I replaced the absent of the character by a X) :

[INFO] 2024-12-21T11:10:58.593Z b81d9bbc-4043-41d5-9169-d822b11cd700 Response generated: Oui, le capteur de prXsence dans la cuisine indique quXil y a quelquXun prXsent.

And also, when the skill asks for further question, it’s in English and not in French. It always says “Anything else?” instead of “Encore quelque chose ?”.

Could explain to me how I can fix that ?

Thanks !

EDIT : in fact, it happens when I ask like that “Alexa, demande à XXXX de …”. But when I enter in skill mode, it says “Encore quelque chose”.