auchter / haaska

Home Assistant Alexa Skill Adapter
263 stars 60 forks source link

Use v3 payload implementation in home-assistant #109

Closed bitglue closed 6 years ago

bitglue commented 6 years ago

Haaska was using the v2 payload, which is now deprecated. Fortunately, home-assistant implemented the v3 payload. https://github.com/home-assistant/home-assistant/pull/11859 exposes this via an HTTP POST, which allows Haaska's Lambda function to be simplified to some trivial glue.

bitglue commented 6 years ago

Heh -- tests fail because everything they tested is gone now.

bitglue commented 6 years ago

@auchter thoughts? With most of the code in Home Assistant there's not much code left here, but I think there's still value in the documentation and a little automation around the setup. If you're on board I might take some time to update the docs.

dhzl84 commented 6 years ago

Your pull request home-assistant/home-assistant#11859 got merged into 0.62. Can't wait for the release to pop up on Hass.io to change my haaska skill integration. Seems like @auchter abandonned this project.

jeroenterheerdt commented 6 years ago

@bitglue @auchter I would love to help out here. I am stuck on the v3 version as well and need some help to get it to work. After running make test I get some results back that look good, but when I try to add my skill in the Alexa app I run into issues (cannot add skill, try again later). I figured, if I help update the docs I might just learn what is wrong in my setup.

TheJulianJES commented 6 years ago

@jeroenterheerdt If you cannot add the alexa skin in your app then you should see if the Client ID and Client Secret from "Login With Amazon" are put in your alexa skill. I also had to go through some trouble but the v3 version work's great but most config options are useless now.

jeroenterheerdt commented 6 years ago

@TheJulianJES Never mind, got it working now. I went ahead and made a quick PR (https://github.com/auchter/haaska/pull/110) for my proposed changes to the docs. It now lists the steps I took. Biggest changes:

jeroenterheerdt commented 6 years ago

@TheJulianJES could you help me understand why Alexa does not discover anything though when I run make test I see a correct result?

TheJulianJES commented 6 years ago

Make sure that the trigger is defined in the lambda function: https://i.imgur.com/nm852jz.png Make sure that the v3 payload is selected: https://i.imgur.com/9RxnZVU.png Make sure that the lambda server is set as the ARN: https://i.imgur.com/rUvCFkj.png (Default)

Also pay attention to: https://developer.amazon.com/de/docs/smarthome/steps-to-build-a-smart-home-skill.html#configure-arns For example, as I live in Germany I need to use the "EU (Ireland)" server location in aws.

I actually had a similar problem that Alexa couldn't find any devices but the test was working, in my case the problem ended up being that I was not logged in correctly on Amazon(.com), so alexa.amazon.com assumed that I lived in the US, so only the location US East (N. Virginia) in AWS was working for me. I just had to relogin. I have not seen anybody else encounter the same issue as me though, so it's probably unlikely.

jeroenterheerdt commented 6 years ago

My function was created in EU (Ireland). I'll check the other stuff tomorrow. Thanks for helping.

anthonylavado commented 6 years ago

I will say, @mike-grant seems to have the furthest along implementation that I've seen: https://github.com/mike-grant/haaska/tree/v3

jeroenterheerdt commented 6 years ago

@anthonylavado the @mike-grant version does not work for me. I reverted to the #109 version of this repo and with the help of @TheJulianJES (thank you!!) I got it working. I have an updated instructions on my fork if you want to have a look.

mike-grant commented 6 years ago

@jeroenterheerdt What failed for you? I'm running that v3 branch currently at home.

jeroenterheerdt commented 6 years ago

@mike-grant the tests failed. Could you not just keep the tests that allow you to test against the published lambda instead of local? The test against public lambda is more interesting. It did work fine when I copy-pasted your code to lambda and also updated the config, though. BTW, I took a stab at updating the docs, see my PR in mike-grants version.

tringler commented 6 years ago

I get get_environ_proxies() missing 1 required positional argument: 'no_proxy' if I use make test or aws lambda add-permission --function-name haaska --statement-id 1 --action lambda:InvokeFunction --principal alexa-appkit.amazon.com --event-source-token [skill-id]

bitglue commented 6 years ago

@tringler If you're seeing that output on stdout, it's probably an issue with your local awscli installation rather than the lambda function.

tringler commented 6 years ago

@bitglue I configured the awscli with access key id, access key, region name and output format as text. What should I do else with the awscli?

bryanyork commented 6 years ago

@tringler What system are you running on? Looks like a known issue in debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=873179

Apparently the pip version works: sudo pip3 install --upgrade boto3

tringler commented 6 years ago

@bryanyork Thanks for helping me out! That solved the problem.

tringler commented 6 years ago

I can confirm that the branch is basically working, but climate devices seems not to be discovered :(

bitglue commented 6 years ago

Climate devices aren't implemented yet (temperature sensors are), though it wouldn't be hard to add them. Mostly I haven't done it because I haven't quite figured out why my z-wave thermostat makes four devices in Home Assistant and how I'm supposed to use them.

Mickelin01 commented 6 years ago

I installed the haaska v3 and it worked perfectly on the first try, great work guys! I did everything per the instructions, except the awscli permissions bit, which seems unnecessary. Now I just need the Smart Home component to support Input Select and Input Number. @bitglue @mike-grant

bitglue commented 6 years ago

Feature requests should be directed at home assistant, since haaska is now only a proxy.

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/alexa/smart_home.py

https://community.home-assistant.io/c/feature-requests

On Sat, Feb 17, 2018, 02:34 Mickelin01 notifications@github.com wrote:

I installed the haaska v3 and it worked perfectly on the first try, great work guys! I did everything per the instructions, except the awscli permissions bit, which seems unnecessary. Now I just need the Smart Home component to support Input Select and Input Number. @bitglue https://github.com/bitglue @mike-grant https://github.com/mike-grant

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/auchter/haaska/pull/109#issuecomment-366423903, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLOWJLrICf8V5Y05B0eRrV5eGX6agO9ks5tVoD3gaJpZM4RoZ8o .

bitglue commented 6 years ago

It does not appear the owner of this repository is active, so I'm closing this PR. The changes have been incorporated at https://github.com/mike-grant/haaska so I'd refer people there.

befaint commented 6 years ago

@bitglue Can you please support me how to "Make a Lambda function to bridge the gap" in your post? (Link: https://gist.github.com/bitglue/66ca023b3c3c1a5b267bdd1d9b3ee48f) Can you post some screenshots when you make the Lambda function?

Thank you.

anthonylavado commented 6 years ago

@befaint The best thing to do is to use the code and wiki we've got available at https://github.com/mike-grant/haaska.

It has the completed version of the Lambda function.

befaint commented 6 years ago

@anthonylavado I set up it and worked for me. Thank you very much. I tried to add the domain "input_number" but Alexa couldn't find any entities (of the "input_number"). Can you please help me?