Home Assistant Assist through Alexa (skill)

Hello,
Ok I fixed it by modifying some lines in the file lambda_function.py :wink:

This looks great.
Your setup instructions for the Alexa skill seem very clear.

However, I’m not sure what to do after setting up the skill.
Specifically,

  1. How do you connect this to HA Assist?
  2. How do you connect it to a 3rd party AI or LLM?
  3. How do you get any responses to be sent as TTS to the Alexa voice initiating the query?

You mention Node Red and I have used it in the past in a very klugey/mechanical way to set up responses for a limited range of pre-defined queries using the existing “My Questions” Alexa skill to capture STT for a limited predefined set of questions.

The (limited) workflow is follows:

[Alexa Speech-to-text] -> [Alexa "My Questions" Skill]
-> [Node Red: Alexa Event node - On Device Activity]
-> [Node Red: Switch node -Filter (one per expected phrase]
-> [Node-Red: Current State node (one per filter output)]
-> [Node Red: Alexa Routine Node - Speak]

Does your approach use a similar, but more general workflow – e.g.,. something like:

[Alexa Speech-to-text] -> [Alexa "New Custom" Skill]
-> [Node Red: Alexa Event node - On Device Activity]
-> [Node Red: "Input to HA Assist engine" or "3rd party LLM" ]
-> [Node-Red: "Output from HA Assist engine" or "3rd party LLM"]
-> [Node Red: Alexa Routine Node - Speak]

Would be great to see some specific examples so I can copy and/or build upon them.

Good day. Thank you for sharing this project.
I configured the AWS option and it works correctly from my mobile app, however from the echos I get “sorry, couldn’t process your request”.

Any guidance is much appreciated.

Good, please submit a pull request or open an issue on github to commit to others users.

Thank you!

Hi,

It have no instruction because it features of HA, not the skill, so, you can found more information about Assist, IA with HA and other HA things in the HA documentation, here is some good information:

Search on Youtube too!

About Node-RED, is not related to skill or the Assist itself, is only the way I found to automate the skill start in Alexa using alexalocal and other plugins, but you do’t need it.

In your lambda project in AWS, go to CloudWatch logs, see the logs and what happens with you echos when executing the skill.

I believe that you missing some configuration when setup your skill or in HA Assist, etc.

Thank you for your prompt response and help.
This is the error I see in the logs:

2024-12-29T07:43:02.054Z
[INFO] 2024-12-29T07:43:02.054Z <edited> Query received from Alexa: turn on office lamp
2024-12-29T07:43:03.012Z
[ERROR] 2024-12-29T07:43:03.005Z <edited> Error processing response: Extra data: line 1 column 4 (char 3) Traceback (most recent call last): File "/var/task/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/lang/lib/python3.12/site-packages/simplejson/__init__.py", line 514, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/lang/lib/python3.12/site-packages/simplejson/decoder.py", line 389, in decode raise JSONDecodeError("Extra data", s, end, len(s)) simplejson.errors.JSONDecodeError: Extra data: line 1 column 4 - line 1 column 18 (char 3 - 17) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/var/task/lambda_function.py", line 176, in process_conversation response_data = response.json() ^^^^^^^^^^^^^^^ File "/var/task/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Extra data: line 1 column 4 (char 3)
2024-12-29T07:43:03.032Z
END RequestId: <edited>

What version are you using?
Have you checked that the environment variables are set correctly?

Is possible to enable Home Assistant debug log for the Assist to view if it’s receiving the request and what is the response? Because your error is regarding the Home Assistant response.

logger:
  logs:
    homeassistant.components.conversation: debug

Thank you again.
So I updated the function to v0.6 (latest)
I activated the homeassistant logger, but I get nothing.
On the CloudWatch logs, now I see this:

HA response data: 401: Unauthorized

So it’s not authorizing the request from the echos.

However, it does work from the mobile app and shows no error in that instance.

Maybe its not compatible with my echos? I have Echo Dot models like this https://images.app.goo.gl/DmA8gWwFjH43VNst5

The skill is compatible with all Echo devices, except Echo Spot.

This error is due to a lack of permission, i.e. the Home Assistant token is not “valid”, so it does not have authorization to access the HA API.

In other words, there is a problem related to the association of your Home Assistant account with the Alexa account (Account Linking), as it does not make sense for it to work on the App and not on the Echo devices.

Is the Amazon account of the Echo device the same as the Alexa App?
Is the language of the Alexa App the same as the Echo device?
Is the region and language of the skill the same as your Amazon account?

Perform these checks and try deactivating and reactivating (relinking) the HA account in the Alexa App and test again.

Fabian
First Happy New Year.
Thank you for your suggestions.
You were, of course, correct.
The phone app was set to UK English, whilst the Echos were set to US English.
Changed the Echo to UK English and problem solved.

Thank you again

1 Like

Hello Gabiano.

Happy new year, and thank you so much for this great skill !!!
I’m surprised that this isn’t more popular considering how useful it is!

I confirm i had the same issue as Neil, maybe you should update the readme regarding home_assistant_url , it must only contains domain without endpoint path :wink:

I’m wondering : must we allways call the skill to wake it up?
i mean : is it possible to setup a fallback, if Alexa doesn’t understand, then it forward the sentence to the skill so we can send orders faster.

In a same goal (be faster) can we disable the skill welcome message?

I use python hosted release at this moment, i’ll play with Gpts and AWS release later :slight_smile:

Thank you again, your skill is really a game changer !!!

At last i have a minor issue, when HA gives feedback, accents are ignored.
For example, assist says “Allumé” but alexa echo says “Allum”, perhaps a file encoding issue…
EDIT : i found the issue is into your improve_response, i’ve edited the line as that :
speech = re.sub(r’[^A-Za-z0-9\s.,!?éèêàùçÉÈÀÙÇ]', ‘’, speech) to fix it.

Hi @giova,

Thank you for your feedback.
I’ll update the documentation to remember regarding home_assistant_url…

About the option to disable welcome message, please, open an issue in github that I’ll take a look this week.

And about encoding issue, you can fork the project and submit a pull request, that I’ll approve it.

Thanks!

Fixed the “example” URL in the config file.

I made some changes in the code.
Could you test your scenario?