[Addon] HA Skill - an addon to setup Alexa Smart Home integration

Hi @adamirr,
Thanks for your addon.
I used for the last years haaska without problems.
But since some days alexa could not control my devices anymore.
So I tried your addon.
But unfortunately I could not complete the setup in „alexa developer console“.
If I put in „AWS Lambda ARN - default endpoint“ the “AlexaEndpoint” from your addon and click save, I get the following error:

Failed to save skill information
  • Please make sure that “Alexa Smart Home” is selected for the event source type, for provided arn [Invalid value] : arn:aws:lambda:eu-west-1:xxxxxxxxxxxxxx:function:ha-skill

Did I do something wrong during setup?
How can I solve this error?

EDIT: here a screenshot:

Did you get this working? I have the same problem.

Hi, If interested, I’ve found a solution :slight_smile:
On AWS, go to your function, delete the alexia trigger, and add a new one, you will have the choice between Alexa skill kit or smart home, choice smart home, and it worked for me

Hi, when trying to install I got the error:
Failed to to call /addons/a11dcb03_ha_skill/install - The command '/bin/ash -o pipefail -c pip3 install --upgrade pip' returned a non-zero code: 1

It seems a typo on /bin/bash

I’m on

  • Core2024.1.0
  • Supervisor2023.12.0
  • Operating System
  • Frontend20240103.3

Hi,

I just merged a pull request that should fix this error. Please try removing and adding the addon again.

Hi Adam,
thanks for the quick reply…
Unfortunately I still get the error.
The addon wasn’t installed so I can only “install” it. Am I wrong?
Let me know if you need other infos…

Just pushed another change to increment the version to 1.0.5. Try again and ensure that’s the version being installed.

If it still doesn’t work, is there more in the logs? If so, paste the whole thing.

Hi Adam,
it worked!
Version .5

Thanks
Carlo

1 Like

I’m trying to configure the “account linking”
What I have to set on “Your Client ID”, “Your secret”?
Other data remain on default values?

Same client ids as documented in the official HA docs

Client ID:

  • https://pitangui.amazon.com/ if you are in US
  • https://layla.amazon.com/ if you are in EU
  • https://alexa.amazon.co.jp/ if you are in JP and AU (not verified yet)

Secret doesn’t matter and is unused.

Sorry for the silly mistake!!!
Now I put a wrong url somewhere and i get a 404.
Is there a way to know what is the wrong url?

2024-01-05 21:57:55 INFO   Polling for work from ha-skill-requests.fifo...
2024-01-05 21:57:55 WARNING SQS Payload: {'body': '{"directive": {"header": {"namespace": "Alexa.Discovery", "name": "Discover", "payloadVersion": "3", "messageId": "xxx-xxx-xxx-xxx-xxxx"}, "payload": {"scope": {"type": "BearerToken", "token": "UNUSED"}}}}', 'response_queue': 'https://sqs.eu-west-1.amazonaws.com/XXXXXXXXX/ha-skill-responses-2024_01_05___LATEST_xxxxxxxxxxxxx.fifo', 'group_id': 'xxxxxxxx-xxxxxxxx-xxxxxx-xxxxxxx-xxxxxxxxx'}
2024-01-05 21:57:55 WARNING Got HA response {'status': 404, 'data': '404: Not Found', 'group_id': 'xxxxxxxx-xxxxxxxx-xxxxxx-xxxxxxx-xxxxxxxxx'}

That call should be made to the HA supervisor API so not a URL you entered. Do you have the smart home feature enabled in your config?

alexa:
  smart_home:

If not you’ll need to add it and reload.

Thanks Adam,
it’s working!!!
Do you think that is possible to send alexa command over the assistant pipeline?
It would be great to send input to chat gpt maybe using the
Extended OpenAI Conversation HACS component (I’m not able to use it yet!)

Glad you got it working. I don’t think this would be easily adaptable to sending ChatGPT commands, but maybe a similar approach could be used to proxy requests. The Alexa skill setup would likely need to be different. (a generic skill instead of a smart home skill).

Hi,

I saw also that my region should be
Europe (Milan) eu-south-1 sqs.eu-south-1.amazonaws.com
instead of
Europe (Ireland) eu-west-1 sqs.eu-west-1.amazonaws.com

It’s better to switch it? How can I do it?

it seems that the sqs server didn’t work. Fixed: probably my connection’s problem!

2024-01-13 19:55:59 WARNING Error polling for messages. Waiting 1 minute to try again. Read timeout on endpoint URL: "https://sqs.eu-west-1.amazonaws.com/"

Tried to ping it on ha server (debian) and another server (windows) but it fails. It should respond to ping?

thanks

Hello, I had the same problem as @kravalli7. The problem is with the mixing of regions. I’m in Central Europe but the alexa account is in the US, so I have to use the “us-east-1” region in HAskill, then everything works. Thanks a lot

Hello everyone.
Thanks Adamirr for your work.
I have this problem:

2024-02-18 02:20:03 INFO   Polling for work from ha-skill-requests.fifo...
Traceback (most recent call last):
  File "/run.py", line 150, in <module>
    poll_for_work(session)
  File "/run.py", line 127, in poll_for_work
    response_queue.send_message(MessageBody=json.dumps(response_payload), MessageGroupId=group_id)
  File "/usr/lib/python3.11/site-packages/boto3/resources/factory.py", line 580, in do_action
    response = action(self, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/boto3/resources/action.py", line 88, in __call__
    response = getattr(parent.meta.client, operation_name)(*args, **params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/botocore/client.py", line 534, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/botocore/client.py", line 976, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the SendMessage operation: One or more parameters are invalid. Reason: Message must be shorter than 262144 bytes.

Any idea concerning the reason and way to fix it ?
No entitys do appear in Alexa App but in debug I have “the big list”

Thanks

Maybe this is in relation ?

Hi,

How big is the “big list”, and are you expecting all of those devices to be controllable by Alexa?

Sounds like the list is too big to broker back to Alexa using the method this Addon uses. The only fix I can think of is to reduce the number of devices you make discoverable to Alexa (which isn’t really a fix so-much as a work around).

I’ll need to think about other ways to solve the response size issue. Not sure when I’ll get to a proper fix though.

The error has nothing to do with the IAM permissions though

Yep it’s quite big.
I’ll reduce to test (i don’t understand why the defaut is "discoverable’ by the way…)
I’ll give you some news.

Thanks

Eric