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

Hey guys I rebooted my mac mini and now the HA Bridge isn't working :( . I tried the following:
 
Neils-Mac-mini:~ neilheuer$ sudo launchctl load /Library/LaunchDaemons/com.ha-bridge.plist

/Library/LaunchDaemons/com.ha-bridge.plist: Service is disabled
 
Any ideas?
 
I kinda figured it out that I have to use -w.  Not sure what it means but you guys helped me setup before but I don't know why its not starting on reboot?  Any thoughts again?
 
I had gotten it to work somehow.  One issue I have is that with my KVM for some reason my mac mini doesn't reboot properly.  Anyway today I just added another switch to the bridge and I did a find devices and it can't not find any devices.  I can still control the known switches so it seems odd that things are working like this.  I did renumber my network and DHCP ranges so I wonder if that has anything to do with the discovery even though it can still communicate?
 
It's supposed to be able to talk to devices without other hubs. So or example, I have an echo and a Phillips Hue hub. You should be able to connect to some of those devices without the Phillips hub using the new echo w/hub.

I haven't seen a list of what devices it directly supports though. That will be the real deciding factor in if it is worth it or not.
 
So I updated my Mac Mini yesterday because of the constant nag, I needed to install growl and that wasn't working for some reason.  Anyway it went over like a lead balloon.  Anyway Its back up and running and I can access the website for the HA Bridge but I couldn't control devices.  I do a search after forgetting all the devices and it is telling me none can be found.  Any ideas?
 
I updated to 5.0 and still doesn't work.  I did install nagios on my machine and I wonder if that is screwing up the upnp for amazon to find the bridge.  Very frustrating all around.  Not sure what to do next.  I have a ton of new IP cameras all that use UPNP so I believe its not a router configuration problem.
 
Just started playing around with this today (Dot's were $30 on Black Friday) but the script provided throws an error in HaikuHelper.  Just trying to test a URL in a browser and I'm getting the following;
 

Unhandled exception in script on line: 0: unitWithNumber() requires a single argument of type Number
 
I've checked the script several times as well as re-copying it but it seems that the call to HaikuHelper isn't getting built correctly.
 

elseif(isset($_GET["newTargetValue"])) { //See If we are passing a unit number to turn on or off
if ($_GET["newTargetValue"] == 1){ //Value is 1 so turn switch ON
hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').on()');
}

elseif($_GET["newTargetValue"] == 0){ //Value is 0 so turn switch OFF
hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').off()');
}
}

Test URL:
 
http://192.168.5.1/haiku.php?newTargetValue=1?DeviceNum=002
 
Running OSX Yosemeti's built-in apache 2.4.16 and php 5.5.38
 
Anyone run into this?
 
Chances are its your editor. Download brackets and try making the file anew. There are hidden characters that cause problems in things like text edit.
 
Thought the same.  Actually re-created another test file by hand directly on the mac using VIM and still getting the same error.

<?php
define('HHAPI_URL', '192.168.5.1:9399 port/api');
define('HHAPI_USER', 'USER');
define('HHAPI_PASS', 'PASS');

// HHAPI Calls

if (isset($_GET["newTargetValue"])) {
if ($_GET["newTargetValue"] == 1) {
hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').on()');
}
elseif ($_GET["newTargetValue"] == 0) {
hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').off()');
}
}

function hhapi($cmd) {
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, HHAPI_URL);
curl_setopt($ch, CURLOPT_USERPWD, HHAPI_USER . ':' . HHAPI_PASS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_POST, 1);
curl_Setopt($ch, CURLOPT_POSTFIELDS, $cmd);

$result = curl_exec($ch);
$error = curl_error($ch);

curl_close($ch);

if($error) echo $error;
return json_decode($result);
}
?>

Helper Error: Unhandled exception in script on line: 0: unitWithNumber() requires a single argument of type Number.
URL: http://192.168.5.1/hh.php?newTargetValue=1?DeviceNum=002
 
Going to play with some hard-coded php files to see if it makes a difference.
 
Thanks
 
 
The following works (hard-coding a unit number and not passing it in the URL)
 

if (isset($_GET["newTargetValue"])) {
9 if ($_GET["newTargetValue"] == 1) {
10 hhapi('controller.unitWithNumber(2).on()');
11 }
12 elseif ($_GET["newTargetValue"] == 0) {
13 hhapi('controller.unitWithNumber(2).off()');
14 }
15 }

Seems like a simple grammar mistake (bear in mind I know almost zero about PHP). 
 
I also tried adding a print statement and passing the original URL to spit out the contents of the $_GET array.
 
Array ( [newTargetValue] => 0?DeviceNum=002 )
 
Are these the expected contents?
 
Thanks again.
 
Got it working.  Really helps if you issue the URL correctly and use the "&" character to separate values.   :blink:
 
Thanks for the help.
 
I am sorry I wasn't around to help.  Seems like this forum stopped emailing me updates to this thread :(
 
Glad you got it working.  My problem is that its awfully slow and most of the time the Dot will say "Your device is not responding" despite it actually working!
 
No worries- Haven't been getting updates either.
 
Haven't really experienced any slowdowns but my Dot(s) are also running pretty "lean" (no additional apps other than Sonos installed). 
 
Back
Top