auchter / haaska

Home Assistant Alexa Skill Adapter
263 stars 60 forks source link

Can you please explain how to use Alexa-adapter on hassio ? I have hassio on rpi 3 and want my home assistant to work with amazon alexa . Thanks #94

Closed sumitrajancse closed 6 years ago

thizzle commented 6 years ago

This should just work with any instance of Home Assistant, as long as you configure the URL in the config.json file. Have you tried following the step-by-step instructions in the README file?

thizzle commented 6 years ago

Also this appears to be a duplicate of #87 .

sumitrajancse commented 6 years ago

The reason I asked this because in hassio make command does not work. Well I got Alexa working with hassio as a smart skill without using this and hence will close this issue.

Thank you.

Dowden commented 6 years ago

did you ever get the "make" command to execute?

cbrherms commented 6 years ago

It doesn't matter where you build your haaska zip. In all honesty if you're attempting to build it on your rpi or in your hassio instance you'll be making things a lot more difficult for yourself. Instead, build it on your normal computer. Make will run on linux, Mac os, and windows 10 (via bash for Windows).

sumitrajancse commented 6 years ago

Well... I want to make alexa work with hassio which is installed on rpi3. I searched many option and haaska was one of them. But as haaska does not work on hassio , I got the Alexa working with my hassio using other method that was very very simple and no make command ,nothing to use. The point is to find a solution of the problem rather than changing the platform to linux, Mac OS or windows. I really appreciate your response, but changing the platform was never a solution for me.

cbrherms commented 6 years ago

Haaska works WITH hassio. It also works with any of other the ways to install HomeAssistant as haaska is an Alexa skill hosted in the cloud that communicates with your HomeAssistant instance. It is not something that is installed on the device that hosts HomeAssistant. Therefore you're not changing the platform where it's installed. The make command just creates the zip file containing your customised config file which you must then upload to the Amazon development console during the skill creation process. This is how creating custom Alexa skills works.

It does not matter where you build the zip file that you upload (using the make command) so therefore you build it on a machine that can use the make command (Mac os, Linux, windows with bash).

Dowden commented 6 years ago

I don't think we understand what the issue is, that everyone is haveing problems with. Or we have not explored what is actually taking place in the HASSKA file when compiled.

The Python code generated from the start of the Readme file, quoted earlier, does not create a readable file that Lamda compiles.

2 questions

Are you Running Haaska on Hassio?

If so how did you get it to compile the haaska.py file?

In theory, Yes you are correct the file runs from the docker files on the Amazon site. I get that!

Note: I did get it to run from an old docker file generated from my old home assistant docker file. The issue I had with it was it was a bunch of broken links. Not all my amazon devices were being picked up in the app and if they were then not all my devices were refreshing properly.

So, in theory, it will work as you state. Practicality is seriously lacking on the part of HASSIO

What everyone is asking is how to create seamless docker files that work. I have exported the haaska directory and zipped it but it never loads properly in the LAMDA function the haaska.py file will not compile.

I am working on this issue now but your responses are not helping resolve the issue, they are seriously confusing. Please clarify what solutions you have found for loading the zip file correctly in the Lamda function.

I am still unclear as to what the resolution is.....Please reopen this

cbrherms commented 6 years ago

Okay, I think i know understand how you think this is meant to work.

Firstly to answer your questions:

Are you running HASSIO?

Yes

Are you Running Haaska on Hassio?

No. Haaska does not run on Hassio. It runs on AWS Lambda and connects to your instance of homeassitant that is running on Hassio via the internet.

So, firstly, the docker file in the haaska repository is there as a way to use the "make" command (please look at the code in dockerfile to confirm, you'll see the command thats run on the last line). It's sole intention is to run make on the files in the haaska folder, then zip them up ready to upload to Lambda.

I've just been able to successfully create a working zip using docker for windows via powershell with the following commands (note, my powershell cli is currently in the haaska source files folder that was cloned from github):

PS D:\Documents\GitHub\test\haaska> docker build -t haaska .
PS D:\Documents\GitHub\test\haaska> docker run -v D:/Documents/GitHub/test/haaska/zip:/usr/src/app haaska

I had to stipulate the exact folder to mount and run the docker container against as the "$PWD" part of the step 2 command in the readme is an environment variable meaning "current directory" on OSX and linux but does not work on windows.

Now, my haaska folder looks like this:

build
config
images
test
.gitignore
.travis.yml
CHANGELOG.md
Dockerfile
haaska.py
haaska.zip
Makefile
README.md

And in it you can see that haaska.zip has been created. This is the file that gets uploaded to your lambda function on the Amazon Developer Console in step 4 of the readme.

The other option to build the zip, is using the make command directly while your teminal is open in the folder with the haaska files. This works natively on linux, and also on mac os though that will ask to install the Xcode Command Line Tools dependency the first time you run it.

So, to build a working zip with your custom config.json file that has your public homeassistant URL and password in it you will need either the "make" command available or "docker" on whatever operating system you are building from the source files on. In the readme it does not state anywhere that you compile your zip on the raspberry pi that your homeassistant is running on (whether HASSIO, hassbian, or a linux install with HA installed using the aio method). If you watched the linked video that brusc had made, he built his on his rpi as he was running hassbian on it at the time, which is a version of linux, and has the "make" command available already.

I believe the linked video should potentially be removed from the Readme now as it's out of date. The Amazon developer console now looks completely different, with settings in slightly different places. Also, the fact he's built it on his rpi causes confusion to people trying to set haaska up as it makes people believe that it must be built on their server that's hosting homeassistant, when this is not the case.

Remember, you're not installing haaska in to your homeassistant server or anything along those lines. You're just building the zipped up app to upload to Amazons developer console and the app is then run from there.

Now, i hope that's cleared a few things up for you.....

Dowden commented 6 years ago

CBR.

Thanks so much for your timely reply!!

Just to clear things up. I agree the links are out of date I also understand that HAASKA runs on AWS.

I have a few more questions. The line you are referring to ("docker build -t haaska . && docker run -v "$PWD":/usr/src/app haaska") returns the following error ( 'ssh: docker: not found' )

The make command/function is not loaded in HASSIO. I am having issues loading the make function on the hosts' system.

I agree that the files linked are outdated and should be removed. I have never used PowerShell. Let me do some research and reply back. Thanks for the insight. Will return with an update at a later date after running your suggestion to ground.

Dowden commented 6 years ago

CBR when did windows systems get interjected into this thread? PowerShell is for windows. or IOT on pi.

Hassio on RBi3 does not run PowerShell without a IOT core from what I can see. Does PowerShell connect directly to the Hassio Host system, without any additional software or configuration? Becuase the problem I am having is I can not configure the 'Make' command and also cannot add it either, this being the simpler solution.

Do you have/know a current workaround for Hassio and RBi, as the thread title suggests? we are looking to get a good docker file that will be accepted within AWS....

Any help on this without a windows solution would be appreciated, I am trying to keep the integrity of the HASSio operating system.

cbrherms commented 6 years ago

It's not a dockerfile that's that's uploaded to aws but a zip file. The reason I used powershell is because I was compiling the zip file on my computer, as you should be too. You should be adapting the instructions to suit the computer your building on. Once you grasp the fact that the instructions do not say to compile it on your hassio/HomeAssistant instance you will find that you'll be able to get it to work. I suggest starting from scratch and rereading the instructions again. Remember, this isn't something that gets installed in to hassio/HomeAssistant. Also, I see from your reply that you ssh'd in to your hassio. What operating system are you running on your client computer?

sumitrajancse commented 6 years ago

@x0x0Atreyux0x0 Hi... Since you are trying to make Alexa for with hassio to turn on light, control switch etc. I can suggest you a simple method . You just need to add few lines in your configuration file, no need to upload lambda function , no need to compile .zip file. You will be able to use commands like " Alexa , turn on kitchen light." , no need to create an Alexa custom skill. Following is the configuration: customize.yaml file

light.cree_connected_a19_60w_equivalent_fe03e539_10: friendly_name: Kitchen Light emulated_hue_name: kitchen light emulated_hue_hidden: false

configuration.yaml file: Please not that you do not need a physical hue device. It is just a logical device. `emulated_hue: host_ip: 192.168.1.27 listen_port: 8300 off_maps_to_on_domains:

alexa:

Please set port forwarding for port 8300 . After that , just restart the home assistant. You will be able to control the lights from Alexa.

In case you have any issue, please free to contact me , I can help you to make that work in most simple manner.

More assistant and documentation for the same available at: https://home-assistant.io/components/emulated_hue/

Dowden commented 6 years ago

sumitrajancse This workaround would be great for a hue network. 90% of my automation is zwave.

trisk commented 6 years ago

@x0x0Atreyux0x0 emulated_hue just speaks the network protocol of a Hue bridge which is native for Google Home and Echo. It works for any devices in Home Assistant and has nothing to do with Hue hardware.

Dowden commented 6 years ago

Thanks trisk I will give it a try. are you running a zwave network with Alexa and emulated hue?

Dowden commented 6 years ago

from the post's have read and the data that I have researched no devices will be found after setup.

Dowden commented 6 years ago

I know that hasska works I got it to work from an old file that I had on a jump drive as a back up I just had some broken links. I have migrated to a new system and rebuilt my entire setup plus added some devices. it is frustrating that Hassio will not let us add functions to the host system. I have also tried generating a ghosted machine on virtual box and it crashed while loading. I was going to use that to create the zip file that is needed to load in Lambda, so the alexa application can run haaska.

Dowden commented 6 years ago

I learned this little tid bit of information shortly after trying. Guess I should have known this but I am kind of grasping at straws here.

VirtualBox lets you run x86 virtual machines on an x86 processor. Raspbian is a distribution for ARM processors. Raspbian cannot run in VirtualBox. Raspbian is essentially Debian with binaries compiled to match the Pi's processor more closely than the official Debian binaries.

I am going to reload with an Ubuntu ghost and see if I can get it to compile.

Got to go for now I am giving up for the night.

The Sad part is the system is running flawlessly otherwise.

I am really considering another platform, like maybe homegenie but I have never used it either.

sumitrajancse commented 6 years ago

Yes... i am running zwave and zigbee network with alexa on rpi3 and it runs good.

trisk commented 6 years ago

@x0x0Atreyux0x0 I think you are still fundamentally misunderstanding several things. You can create the zip file for haaska on literally any Linux or Unix computer with Python and GNU make installed, or any system that can run Docker. If your desktop runs Windows, you can run Docker or Cygwin or a normal Linux distribution in a VM.

It has nothing to do with the system you run HA on.

cbrherms commented 6 years ago

I'm going to unsubscribe from this issue now as no matter how many ways it's been said, the point hasn't gotten across.

TurboTronix commented 5 years ago

I tried powershell, I tried cygwin and I always get the same thing:

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnecti nError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc56f79ca20>: Failed to establish a new co nection: [Errno -3] Temporary failure in name resolution',)': /simple/requests/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConn ction object at 0x7fc56f79c860>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/requests/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConn ction object at 0x7fc56f79c908>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/requests/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConn ction object at 0x7fc56f728358>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/requests/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConn ction object at 0x7fc56f728710>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/requests/

No clue how to fix this...

cbrherms commented 5 years ago

Do not comment on a closed issue asking for help. Create your own issue, making note of exactly what steps you took as well as the output.