Jump to content


Photo
- - - - -

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


  • Please log in to reply
299 replies to this topic

#286 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 21 June 2017 - 08:44 PM

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?



#287 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 21 June 2017 - 08:53 PM

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?



#288 networkcrasher

networkcrasher

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 174 posts
  • Location:Atlanta

Posted 22 June 2017 - 01:10 AM

Did you try to google it?  Are you running RunAtLoad in your plist?

 

install launchcontrol if you need a gui http://www.soma-zone.../LaunchControl/



#289 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 29 July 2017 - 08:27 PM

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?



#290 SJHart

SJHart

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 295 posts

Posted 21 October 2017 - 09:21 AM

Anyone understand the difference with the new echo with built in hub? Thanks. SJ

#291 cobra

cobra

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 358 posts
  • Location:SouthEast PA, USA
  • Experience:average
  • Software:Custom
  • Tech:UPB, Z-Wave

Posted 21 October 2017 - 09:08 PM

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.

#292 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 27 November 2017 - 07:32 AM

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?



#293 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 27 November 2017 - 09:28 AM

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.



#294 SNXLLC

SNXLLC

    Cocooner

  • Registered
  • PipPip
  • 27 posts

Posted 27 November 2017 - 04:35 PM

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/h...1?DeviceNum=002

 

Running OSX Yosemeti's built-in apache 2.4.16 and php 5.5.38

 

Anyone run into this?



#295 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 27 November 2017 - 05:40 PM

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.

#296 SNXLLC

SNXLLC

    Cocooner

  • Registered
  • PipPip
  • 27 posts

Posted 28 November 2017 - 10:43 AM

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/h...1?DeviceNum=002

 

Going to play with some hard-coded php files to see if it makes a difference.

 

Thanks

 



#297 SNXLLC

SNXLLC

    Cocooner

  • Registered
  • PipPip
  • 27 posts

Posted 28 November 2017 - 11:02 AM

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.



#298 SNXLLC

SNXLLC

    Cocooner

  • Registered
  • PipPip
  • 27 posts

Posted 28 November 2017 - 01:12 PM

Got it working.  Really helps if you issue the URL correctly and use the "&" character to separate values.   :blink:

 

Thanks for the help.



#299 heffneil

heffneil

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 629 posts

Posted 04 March 2018 - 08:23 AM

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!



#300 SNXLLC

SNXLLC

    Cocooner

  • Registered
  • PipPip
  • 27 posts

Posted 04 March 2018 - 10:14 AM

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). 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users