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

so @heffneil, you weren't able to get it running at all?  Are you using port 80?  it should run as root so it should fire up no problem
 
i modified my post to included the chown statement
 
I guess that is the same directory but it isn't where i put the same files you suggested so I have to find it now.  Any sugestions?  I know I went in library but I guess there are multiples?
 
heffneil said:
I followed other directions and it is in /Library/LaunchAgents
 
That one seems to work on reboot.
I don't believe LaunchAgents fires off as root, but would have to look into it.  I use LaunchDaemons and didn't have any issues.  If you're using port 80, then it needs to run as root.  As it's a daemon, that's where I felt appropriate to put it.
 
I have no clue where your paths point to.  You're supposed to decide that and update the plist, not me."/PATH/TO" should be updated to wherever you want to put things.
 
Mine is in /Users/mark/ha-bridge, but that's just where i decided to put it.
 
All of this shouldn't be that difficult :)
 
I had lots of errors.  I went back to my file but I am putting this in /Users/neilheuer/Library/LaunchAgents
 
/Library/LaunchDaemons/com.ha-bridge.plist: No such file or directory
Neils-Mac-mini:LaunchAgents neilheuer$ sudo launchctl load com.ha-bridge.plist
/Users/neilheuer/Library/LaunchAgents/com.ha-bridge.plist: Path had bad ownership/permissions
Neils-Mac-mini:LaunchAgents neilheuer$ sudo chown root:wheel /Library/LaunchDaemons/com.ha-bridge.plist
chown: /Library/LaunchDaemons/com.ha-bridge.plist: No such file or directory
Neils-Mac-mini:LaunchAgents neilheuer$ sudo chown root:wheel com.ha-bridge.plist
Neils-Mac-mini:LaunchAgents neilheuer$ sudo launchctl load com.ha-bridge.plist
/Users/neilheuer/Library/LaunchAgents/com.ha-bridge.plist: Service is disabled
Neils-Mac-mini:LaunchAgents neilheuer$ sudo launchctl load com.ha-bridge.plist
/Users/neilheuer/Library/LaunchAgents/com.ha-bridge.plist: Service is disabled
Neils-Mac-mini:LaunchAgents neilheuer$ sudo launchctl load ha-bridge.plist 
/Users/neilheuer/Library/LaunchAgents/ha-bridge.plist: Path had bad ownership/permissions
Neils-Mac-mini:LaunchAgents neilheuer$ sudo chown root:wheel ha-bridge.plist 
Neils-Mac-mini:LaunchAgents neilheuer$ sudo launchctl load ha-bridge.plist 

Neils-Mac-mini:LaunchAgents neilheuer$ 
 
there's a whole lot of wrong in those logs, but you seem to have multiple plists and I can't really tell what directory you're running these from.  I will say one thing - if you run the web port on 80 and try to put in in /Users/neilheuer/Library/LaunchAgents, it won't work right as the app will start as user 'neilheuer' and won't be able to bind to 80.  That's why i suggested putting it in /Library/LaunchDaemons as it will start as root.
 
If you're following a guide elsewhere, I guess you should continue to follow that, as the directions we provided in the thread obviously aren't working for you for some reason. I've never used launchd before and had it working in about 5 minutes doing my method.  I didn't really consult the internet other that to figure out the format of the plist xml.  You might also try to install "LaunchControl" at http://www.soma-zone.com/LaunchControl/ to try and troubleshoot your plist.
 
Its not port 80 thats the problem here. I have that part all resolved. The issue is something your file right now.  Not sure why but it keeps throwing errors when I try yours.  Here is what I am using:
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>HA-Bridge</string>
  <key>ProgramArguments</key>
  <array>
    <string>java</string>
    <string>-jar</string>
    <string>ha-bridge-3.2.1.jar</string>
  </array>
  <key>RunAtLoad</key>
  <true/> <!-- run the program at login -->
  <key>KeepAlive</key>
  <true/> <!-- run the program again if it terminates -->
  <key>WorkingDirectory</key>
  <string>/Users/neilheuer/ha-bridge-master/target</string>
</dict>
</plist>
 
This is mine, verbatim:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.ha-bridge</string>
<key>ProgramArguments</key>
<array>
<string>java</string>
<string>-jar</string>
<string>/Users/mark/ha-bridge/ha-bridge-3.2.0.jar</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/mark/ha-bridge/stderr</string>
<key>StandardOutPath</key>
<string>/Users/mark/ha-bridge/stdout</string>
<key>WorkingDirectory</key>
<string>/Users/mark/ha-bridge/</string>
</dict>
</plist>


Notice I use a trailing slash on the WorkingDirectory and specify a full path to the jar.
 
this is what the program directory looks like:

neo:LaunchDaemons mark$ cd
neo:~ mark$ cd ha-bridge/
neo:ha-bridge mark$ ls -la
total 14288
drwxr-xr-x@ 17 mark staff 578 Nov 3 22:47 .
drwxr-xr-x+ 34 mark staff 1156 Nov 3 22:47 ..
-rw-r--r--@ 1 mark staff 6148 Oct 26 21:56 .DS_Store
drwxr-xr-x@ 13 mark staff 442 Oct 24 01:46 .git
-rw-r--r--@ 1 mark staff 378 Oct 24 01:46 .gitattributes
-rw-r--r--@ 1 mark staff 200 Oct 24 01:46 .gitignore
-rw-r--r--@ 1 mark staff 561 Oct 24 01:46 .project
-rw-r--r--@ 1 mark staff 11358 Oct 24 01:46 LICENSE
-rw-r--r--@ 1 mark staff 91431 Oct 24 01:46 README.md
drwxr-xr-x@ 8 mark staff 272 Oct 31 16:48 data
-rw-r--r--@ 1 mark staff 7163557 Oct 24 01:48 ha-bridge-3.2.0.jar
-rwxrwxrwx 1 root staff 0 Nov 3 22:32 ha-bridge.log
-rw-r--r--@ 1 mark staff 5931 Oct 24 01:46 pom.xml
drwxr-xr-x@ 4 mark staff 136 Oct 24 01:47 src
-rwxr-xr-x 1 mark staff 223 Nov 3 22:18 startup.sh
-rw-r--r-- 1 root staff 664 Nov 3 22:40 stderr
-rw-r--r-- 1 root staff 4518 Nov 6 21:15 stdout
neo:ha-bridge mark$ ls -la data/
total 56
drwxr-xr-x@ 8 mark staff 272 Oct 31 16:48 .
drwxr-xr-x@ 17 mark staff 578 Nov 3 22:47 ..
-rw-r--r--@ 1 mark staff 6148 Oct 26 23:10 .DS_Store
-rw-r--r-- 1 root staff 1737 Oct 29 10:34 device.db
-rw------- 1 root staff 1054 Oct 31 16:48 habridge.config
-rw-------@ 1 mark staff 779 Oct 24 02:25 habridge.config-2016-10-24-15-52-43.cfgbk
-rw-r--r-- 1 root staff 1078 Oct 29 10:31 only3.bk
-rw-r--r-- 1 root staff 1737 Oct 29 10:34 with garage doors.bk
neo:ha-bridge mark$


Obviously I'm on 3.2.0, but it shouldn't matter.

What sort of errors is it throwing?  Is yours working now?
 
No I am using mine - not yours.  I don't know why its failing and I just looked at logs and it looks like it keeps trying to run it so Im going to try to stop it :)
 
So the service is running but I get this in my logs:
 
11/7/16 8:46:51.671 AM com.apple.xpc.launchd[1]: (com.ha-bridge[638]) Service could not initialize: 15G1004: xpcproxy + 12684 [1462][F7717708-ACF7-307D-B04E-998DFC36598F]: 0xd
11/7/16 8:46:51.671 AM com.apple.xpc.launchd[1]: (com.ha-bridge) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
11/7/16 8:47:01.678 AM com.apple.xpc.launchd[1]: (com.ha-bridge[643]) Service could not initialize: 15G1004: xpcproxy + 12684 [1462][F7717708-ACF7-307D-B04E-998DFC36598F]: 0xd
11/7/16 8:47:01.679 AM com.apple.xpc.launchd[1]: (com.ha-bridge) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
11/7/16 8:47:11.689 AM com.apple.xpc.launchd[1]: (com.ha-bridge[647]) Service could not initialize: 15G1004: xpcproxy + 12684 [1462][F7717708-ACF7-307D-B04E-998DFC36598F]: 0xd
11/7/16 8:47:11.689 AM com.apple.xpc.launchd[1]: (com.ha-bridge) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
11/7/16 8:47:21.699 AM com.apple.xpc.launchd[1]: (com.ha-bridge[651]) Service could not initialize: 15G1004: xpcproxy + 12684 [1462][F7717708-ACF7-307D-B04E-998DFC36598F]: 0xd
11/7/16 8:47:21.699 AM com.apple.xpc.launchd[1]: (com.ha-bridge) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
 
Ok just to clarify something.  There is /Library/LaunchAgents/ and then there is /users/USERNAME/Library/LaunchAgents/ Not sure which is correct but one is working and one is error badly :)
 
Ok clearly I am distracted - I was using LaunchAgents and not Daemons.  I think I fixed all this up and use the MAIN Library folder, not users/XXX/Library which was another problem.  I am rebooting now but I suspect it will work now. 
 
That could be a problem.  LaunchAgents I believe runs in the user context, whereas LaunchDaemons is root.  *nix is picky like that :)
 
the 0xd at the end of the error log suggests Permission Denied, so that's likely your issue.  Make sure the permissions on the plist are set to root:wheel. (ie ls -la /Library/LaunchDaemons/com.ha-bridge.plist ; chown root:wheel /Library/LaunchDaemons/com.ha-bridge.plist). Also you can probably check perms on the ha-bridge files themselves.  My guess is some of them are owned by root and starting in the user context prevents said user from accessing the files, hence the 0xd.
 
Back
Top