Ok, so I used your latest post as a guide and managed to get it up and going for the most part. The problem is, my use case is more in line with what @destructure00 seems to be doing. At least in the sense that I have multiple hubs and am looking to have virtual switches turn on or off based on whether an activity is running. Is there any way to use the client.js template he posted up above (post #25) as a replacement for the app.js template you provided? As it stands now, I have the app up and running on my Raspberry Pi, but I don't have it actually connected to my Hubitat since I'm not using the Harmony Connect app.
You can use @destructure00 version too. If you have switches in HUbitat than you can just use those in the MakerAPI app. No difference really. I refresh verses turn on/off. We are working on another version that enables us to select either or both depending on the situation.
From looking through your code, I think I see how I can change the "refresh" commands to either "on" or "off" where appropriate. Is there a way to easily add my second hub to your script?
Also, for some reason I started running into an issue this morning. As of last night I could get the script up and running and could watch hub updates in my ssh terminal. This morning I deleted the app.js file and decided to remake it with the changes needed to control virtual switches. For some reason, when I run "node app.js" now, I get the following error.
SyntaxError: Invalid or unexpected token at new Script (vm.js:83:7) at createScript (vm.js:267:10) at Object.runInThisContext (vm.js:319:10) at Module._compile (internal/modules/cjs/loader.js:685:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10) at Module.load (internal/modules/cjs/loader.js:620:32) at tryModuleLoad (internal/modules/cjs/loader.js:560:12) at Function.Module._load (internal/modules/cjs/loader.js:552:3) at Function.Module.runMain (internal/modules/cjs/loader.js:775:12) at startup (internal/bootstrap/node.js:300:19)
Not sure what changed and how to fix it.
I would go back to your working app.js script. You probably have a missing ending operator.
Are you using the forever-service to boot as a service? If so you will need to copy your /share/harmony to /share/harmony2 and then just execute the foforever-service but use harmonyhub2 as the service name. Obviously modify your app.js file accordingly.
I'm going to work my way through your walkthru again to see if I can figure out where I went wrong. I did notice a couple of issues the first time I went through it. The two steps below seemed to be out of order. When I tried to install the Sleep Service I got an error that the directory wasn't there. It seems like the /share/harmony folder isn't created until the next step. I just did that part first, then went back to the Sleep Service step.
Install Sleep Service (must be SuperUser) su cd /share/harmony npm install sleep --save Install HarmonyHub Real-time Updates mkdir /share/harmony cd /share/harmony su npm install harmonyhubjs-client --save
I also ran into an issue because I didn't have Git installed on my Raspberry Pi. I had to go install that at one point to fix an error.
Found one other issue in the walkthru. I think there's a space missing after the nano command in the step below.
Ok, I think I managed to get everything working. The error I reported this morning seemed to have something to do with me copying the app.js template into TextEdit to make my changes rather than pasting directly to the RPi via SSH and making the changes in nano. It was easier for me to navigate via TextEdit, but obviously something got messed up somewhere in the transition. I followed your directions on creating a second folder and service. As far as I can tell, everything is working as it should. Thanks again for all the assistance.
Go out ad download Visual Studio Editor. Best tool for all of this without messing up your code.
Is there any reason why I couldn't run this and KuKuHarmony on the same Raspberry Pi 2?
Should be able to. I run a lot of stuff on my pi. I just got my third pi so I can do custom HUE/Tradfri integration with Hubitat. Working on that now. Also I use a Pi to control my 3d printer.
It seems to be working so far. Thanks again.
Since Logitech has at least somewhat reversed course on this, will development on this be picked back up again?
I will help fix once Harmony releases their updated XMPP protocol.
What did Harmony do that development stopped on this? I am just curious as I don't remember getting an update to my Harmony hub at all.
They shutdown the XMPP port that is used to monitor activity.
I believe it’s already released. I followed the directions on the Logitech site, and it started working again.
Not officially released. There is a beta with manual intervention. But soon!
Something tells me this will never be officially released out of beta. They added back because of the community outcry but I doubt they will "support" it. They don't want the average Joe to feel comfortable with having this enabled. Adding the word official, also implies supported and maybe even recommended.
Logitech staff posted in another thread somewhere that XMPP would be maintained going forward. There's links in the other big Harmony thread on our forum.
Check here for a new beta integration from @ogiewon