Haiku Using Amazon Alexa devices (Echo, Dot, Tap, etc.) with HAI

THe bridge defaults to port 80. However the override parm should change that (unless of course 8081 is also in use).
 
Try running a port scan on your mini using Network Utility (in Applications/Utilities) just to confirm the ports that are in use.
 
Here are the results
 
 
 
Port Scanning host: 192.168.1.177
 
Open TCP Port: 80     http
Open TCP Port: 88     kerberos
Open TCP Port: 445    microsoft-ds
Open TCP Port: 548    afpovertcp
Open TCP Port: 1618   skytelnet
Open TCP Port: 3689   daap
Open TCP Port: 4502
Open TCP Port: 5842
Open TCP Port: 5900   rfb
Open TCP Port: 5901
Open TCP Port: 9399
Open TCP Port: 32400
Open TCP Port: 32469
Open TCP Port: 45601
Open TCP Port: 45633
Open TCP Port: 49152
Open TCP Port: 49193
Port Scan has completed…
 
Alright, so don't be mad, but I typed in the command wrong.  When I typed 'java -jar -Dserver.port=8080 ha-bridge-3.2.0.jar' it worked!
 
I had the order incorrect before. I told you I'm a complete novice, but learning fast!
 
I can now access the ha bridge website at 192.168.1.177:8080
 
I'm ready for the next step please.
 
Go to http://192.168.1.177:8080/configurator.html and add a device that you want the Echo to control. You will need to specify the On and Off urls per the earlier discussion here. The URLs must point to files in the Library/WebServer/Documents directory. Once you can hit test in the configurator and control the device(s), you can ask Echo to find the bridge.
 
This part really confuses me. I went to http://192.168.1.177...nfigurator.html[SIZE=13.6px] and the website pops up now, but I don't understand how to do the next steps you're talking about. Do I need to put files in the [/SIZE]Library/WebServer/Documents directory, or is it something that's already there? There are 4 files already in that directory, but they're pretty old and two of them are gif files.
 
I guess I'll need to create a file to put in there, but that's where I'm stuck.
 
Thank you.
 
Yes, you will need to put a file there. See Post #20 in this thread. You will also need to enable php support in Apache, see Post #38 in this thread. You can use the template in #20 for each device you want to control in which case you will have 2 files for each device (one for On and one for OFF). Of course, if you program in php, you can have one file but it is not necessary.
 
Textedit should work but be sure to name the file with .php. It needs to be in the /Library/WebServer/Documents directory and the webserver (apache) must have php enabled (see #38). Yes each light or whatever you are controlling will be defined using the configurator page.
 
I've enabled php per the #38 post and tested it. That works.
 
I copied and pasted your example from #20 into Textedit. I put in 192.168.177:8080 for my ipaddress and port, my username and password for HH, then saved it as a php file in the /LIbrary/WebServer/Documents directory. When I went to test it didn't work.
 
I'm going to 192.168.177:8080 as I'm using the HA Bridge as heffneil recommended it for dimming lights.
 
What I still don't understand is the coding from post #20 supposed to be for turning lights on, off or dimming? I know I'm in over my head, but I feel like I'm pretty close to getting this.
 
heffneil, you mentioned in an earlier post you were going to document and detail?  How's that coming along?  :)
 
When you say it doesn't work, I am assuming you mean that if you click test in the configurator, the device is not turned off (or on). As far as what the script does, it simply authenticates to HH and then executes the API call (HHAPI). In this case it does an API call with a dim parameter if there is one else it toggles the device. Obviously you can change the API call for whatver device you are controlling. The HH API is fully documented in the Javascript Bridge API. If the Test button is not controlling your light, I would look at the /var/log/apache2 and see if there are any errors associated with the .php file.
 
The first step would be to use a URL in your browser at home to call the php page and see what that does. If that works you can go on to step two which would be testing via the bridge interface. The URL for testing should be your Mac mini ip and then the path to the php file with some URL variables to the php page does what you want it to do if you followed my code. The original way was to write a page for ea h device which is a lot of work
 
I appreciate your help and patience, but I'm very confused.  Right now I'm trying to turn on and off the light in my study.  I do want the ability to dim, but baby steps. When I open the Web Interface from HH it lists my study light as device #66.
 
Heffneil, which code of yours would I use?  Right now, I'm using ihf's code from post #20.
 
Couple of questions are:
 
1. What port should I refer to in that code? The port for the ha bridge, or the port the HH Web Wnterface is using?
 
2. The username and password I'm using is the one I use to log into the HH Web Interface.  Is this correct?
 
2. I am looking at the Javascript Bridge API documentation under the section 'Accessing the API from a PHP script.' It looks similar to the code from post #20, but due to my lack of programming skills I'm not sure which parts I need to change to be specific to my setup.
 
Again, thank you for all your help!
 
Back
Top