auchter / haaska

Home Assistant Alexa Skill Adapter
263 stars 61 forks source link

No Devices Found #86

Open psinide opened 7 years ago

psinide commented 7 years ago

Hi, I followed your instructions and setup the Lambda function and linked it with the Alexa skill. I am not able to discover devices through the Alexa app. When I run the test I found here:

{
  "header": {
    "payloadVersion": "1",
    "namespace": "Control",
    "name": "DiscoverAppliancesRequest"
  },
  "payload": {
    "accessToken": "whatever"
  }

}

I get the following error:

Traceback (most recent call last):
  File "/var/task/haaska.py", line 668, in event_handler
    ha, payload)
  File "/var/task/haaska.py", line 294, in invoke
    obj = make_class(allowed)(namespace, name, ha, context)
AttributeError: type object 'allowed' has no attribute 'Control'

Any suggestions? ( I checked one of the closed issues which had a similar problem, and their issue resolved once they changed the lambda server to n.virginia, my Lambda function is already on n.virginia)

trisk commented 7 years ago

That's for an old API version, I'm not sure how people keep finding it? Please use the discovery test example from the list in the AWS Lambda console, or if you have the tools installed, just run make test.

psinide commented 7 years ago

Thanks for the quick response. I used the preset discovery test in the AWS console and its populating with all my devices on HASS, but the Alexa app still can't discover any...

trisk commented 7 years ago

Is the Lambda function getting executed? Problem could be the skill settings.

faspina commented 7 years ago

I am having the same problem. The discovery test works from lambda , it returns all my devices, but discover in alexa does not

faspina commented 7 years ago

I got it to wrk, not sure what I did, maybe rebuilt the skill, now its working

ghost commented 7 years ago

Had the same problem, and after a lot of trial and error I found what caused my Alexa not to discover anything... an empty "friendly name" item. I just marked it as haaska_hidden and after that it works great again.

cooperaj commented 7 years ago

Also seeing this error. Best I can tell it's all setup correctly. The test works (n.b. the old one that doesn't work is listed off the video you provide for instructions :P ) but alexa doesn't seem to want to even call the end point.

All my devices have friendly names.

tradel commented 7 years ago

For anyone else having this problem, make sure your skill is configured to use payload version 2. v3 is the new default, but Haaska doesn't understand v3 yet.

cooperaj commented 7 years ago

Not gonna be able to try this until I get home - but should it work, thanks :)

Now if only alexa would have told me it was unable to talk to the function...

tradel commented 7 years ago

If you check the Cloudwatch logs for your lambda function, you'll probably see error messages like this:

'header': KeyError
Traceback (most recent call last):
File "/var/task/haaska.py", line 661, in event_handler
name = event['header']['name']
KeyError: 'header'

That's the indication that you've accidentally set up your skill for v3 instead of v2.

NorbertWasilewski commented 7 years ago

I had same problem. Lambda function was working properly, but it wasn't called by Alexa API. It came out, that your Amazon account (not AWS) region does matter. If your account was created for US you need to use US datacenter (eu-east-1 im my case) region for lambda function. if you registered in Europe pick one of EU datacenters.

absk1s3 commented 7 years ago

I have a similar problem! But I have set my AWS datacenter to eu-west-1 (Ireland) and made sure my endpoint in developer.amazon.com points to the eu-west-1 and it still not working. I wonder if its a problem in the account linking with the information from login.amazon.com.

absk1s3 commented 7 years ago

Sorry I meant I am having the same problem as NorbertWasilewski, tried his solution but still not working. Im based in UK

cooperaj commented 7 years ago

Mine started working after I selected the v2 payload as suggested by Todd On Thu, 5 Oct 2017 at 07:58, Abul Koyes notifications@github.com wrote:

Sorry I meant I am having the same problem as NorbertWasilewski, tried his solution but still not working. Im based in UK

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/auchter/haaska/issues/86#issuecomment-334376179, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYbUlaPiCRCBUJGiuSyEhk01aONxG6Cks5spH4IgaJpZM4O3i3O .

absk1s3 commented 7 years ago

Hmmm. The problem seems to be very unique to me as I have selected payload v2 (legacy). I followed everything, making sure that the datacenter is eu.

What authorization url are you using mine is:

https://www.amazon.com/ap/oa

And for access token uri:

https://api.amazon.com/auth/o2/token

I'll probably restart the whole process again from scratch and see if that works.

On 5 Oct 2017 12:00 pm, "Adam Cooper" notifications@github.com wrote:

Mine started working after I selected the v2 payload as suggested by Todd On Thu, 5 Oct 2017 at 07:58, Abul Koyes notifications@github.com wrote:

Sorry I meant I am having the same problem as NorbertWasilewski, tried his solution but still not working. Im based in UK

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/auchter/haaska/issues/86#issuecomment-334376179, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAYbUlaPiCRCBUJGiuSyEhk01aONxG6Cks5spH4IgaJpZM4O3i3O .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/auchter/haaska/issues/86#issuecomment-334431881, or mute the thread https://github.com/notifications/unsubscribe-auth/AGyYB50Pl1cgNl6bPqNp0oMpcMdn4uF2ks5spLawgaJpZM4O3i3O .

absk1s3 commented 7 years ago

I started again from scratch and it finally worked! guess I made a mistake somewhere in my previous setup. Thanks of your help @cooperaj

maddox commented 7 years ago

I've just had this die on me after working for months. I hadn't changed anything.

I checked the logs and it's throwing the same error:

'header': KeyError
Traceback (most recent call last):
File "/var/task/haaska.py", line 661, in event_handler
name = event['header']['name']
KeyError: 'header'

I checked the payload version and it was using v2. I even switched to v3 and back to v2 just to try to kick it.

tradel commented 7 years ago

That error means the skill is receiving v3 format. Are you sure you switched back to v2?

On Thu, Oct 5, 2017 at 5:25 PM, Jon Maddox notifications@github.com wrote:

I've just had this die on me after working for months. I hadn't changed anything.

I checked the logs and it's throwing the same error:

'header': KeyError Traceback (most recent call last): File "/var/task/haaska.py", line 661, in event_handler name = event['header']['name'] KeyError: 'header'

I checked the payload version and it was using v2. I even switched to v3 and back to v2 just to try to kick it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/auchter/haaska/issues/86#issuecomment-334596757, or mute the thread https://github.com/notifications/unsubscribe-auth/ABsTv9yfMpdyjMH6m6dblSOSS9HEG0Kyks5spUlkgaJpZM4O3i3O .

maddox commented 7 years ago

It was originally already set to v2. I woke up this morning and everything was working fine. So something must have messed up on Amazon's side?

tradel commented 7 years ago

I suspect something got borked when they were rolling out all the new Alexa API's this week, in conjunction with all the product launches.

On Fri, Oct 6, 2017 at 12:33 PM, Jon Maddox notifications@github.com wrote:

It was originally already set to v2. I woke up this morning and everything was working fine. So something must have messed up on Amazon's side?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/auchter/haaska/issues/86#issuecomment-334805781, or mute the thread https://github.com/notifications/unsubscribe-auth/ABsTv6gP81fkRg7nwh-f_mMvqlnr6OObks5splZDgaJpZM4O3i3O .

maddox commented 7 years ago

I suspect something got borked when they were rolling out all the new Alexa API's this week, in conjunction with all the product launches.

My thoughts exactly.