[OBSOLETE] KuKuHarmony - DTH and SmartApp that support to control devices in Logitech Harmony(using Harmony-API)

Mate, you do amazing work. HAD to do a shout out for ya! I didn’t know you and @bamarayne were merging projects. Even better and I have had both running and it’ll be awesome to see what you two can pull together.

Yup. That’s exactly what it does. Basically, all the DTHs in KuKu support Actuator, Configuration, Health Check, Refresh, Sensor, Switch. So, yes, if you have an open/close event handled, you can turn on/off devices exposed through KuKu. You can also have things trap on switch events from exposed KuKu devices.

So, let’s say that I want my fireplace to turn off if my front windows open. In Smart Lighting, I can setup a trigger on my window sensors and have the trigger turn off the fireplace if a window opens and on if the window closes. I haven’t tried it, but I believe @KuKu stated that you can do even more with webCoRE.

Does that make sense? I’m barely through my first cup of coffee. LOL

Actually, Jason left Echosistant and the guy who wrote NST Manager took over, and it was he and I that started talking about integrating some of the features into Ask Alexa. Either way, I appreciate the kind words!

1 Like

Oh, Total opposite of what I thought it was. I thought it was some sort of monitor to keep the app and the server in sync. So it is just basically setting up triggers in the app.

So A little disappointed, I just confirmed my theory, There is nothing in place to keep the status of the switch in check with the actual device in the hub. So lets say I turn on the TV using the harmony remote, it will not reflect in the new TV device created by this app that the TV is on. It is showing the TV as off.

Did I missing something? If the switch is showing the TV as on and it is actually off, I have to hit the switch once to turn it off and then another to turn it back on.

So lets say I turn on the TV using the harmony remote, it will not reflect in the new TV device created by this app that the TV is on. It is showing the TV as off.

I can confirm that’s true for me too at least… unfortunately.

I think that’s actually part of the Harmony API side. It only updates every 5 minutes in the new fork. Maddox’s (which is what I am running on my Linux box) checks every minute, so I don’t see the syncing problem.

If you feel like it, you can change the time period in the app.js in the harmony-api project and then restart it. Hell, you could probably even set it to 30 seconds. I don’t know if it would flood the Harmony hubs or not.

The timeouts are at lines 17, 21 and 25:

  1. var harmonyActivityUpdateInterval = 5601000 // 5 minutes

  2. var harmonyStateUpdateInterval = 5*1000 // 5 seconds

  3. var harmonyDeviceUpdateInterval = 5601000 // 5 minutes

An easy way to test this is to turn the TV on via the remote. Wait 5 minutes and look at the status in ST.

2 Likes

I’m not sure why I even thought of installing this on my windows machine when I had an older pi that I use for vlcthing. Short story… I got it installed and configured, now I’m just trying to figure out why the device I’m trying to control is not powering on/off even though I don’t see any errors in the ide.

Any hints on troubleshooting that? The activity the device is included in works properly.

Can you use something like postman to send the request directly to the harmony-api? Then, watch the console and see if it suits out an error.

That’s the first step I would take.

⁣Sent from BlueMail ​

Can anyone help me install everything from scratch on raspberry pi 3?
I’m not very experienced and I need a step by step guide.
I tried to install this:
"sudo apt-get update
sudo apt-get install git nodejs npm
cd / opt
npm install forever -g --save
git clone https://github.com/maddox/harmony-api.git2
cd harmony-api
sudo script / install-linux "
arrived at this point I was answered:

  • set -e
    ++ dirname script / install-linux
  • cd script / …
  • INSTALL_PATH = / var / lib / harmony-api
  • CONF_PATH = / etc / harmony-api
  • echo 'Installing harmony-api for Linux …'
    Installing harmony-api for Linux …
  • mkdir -p / var / lib / harmony-api
  • cp -R app.js config Dockerfile LICENSE log npm-debug.log package.json public README.md script / var / lib / harmony-api
  • ln -sf / var / lib / harmony-api / config / etc / harmony-api
  • ln -sf /var/lib/harmony-api/config/harmony-api-server.service / etc / systemd / system /
  • systemctl enable harmony-api-server.service

what should I do?

You’re really close. Test that the server is running by running /var/lib/harmony-api/script/server. If you get “Starting Discovery” and you see your hub(s) getting discovered, You’re in business. You can further test this by going to http://[your pi ip address]:8282 and checking to see if you see the Harmony API home page.

From there, just run systemctl start harmony-api-server.service and you should be good to go.

1 Like

rn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
error: Could not read .foreverignore file.
error: ENOENT: no such file or directory, open ‘/var/lib/harmony-api/.foreverignore’
module.js:327
throw err;
^

Error: Cannot find module ‘mqtt’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/var/lib/harmony-api/app.js:4:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
error: Forever detected script exited with code: 1

Did you run /var/lib/harmony-api/script/bootstrap? (I ALWAYS forget about doing that).

1 Like

no, dont work:
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b for-harmony-api git://github.com/maddox/harmonyhubjs-client.git /root/.npm/_cacache/tmp/git-clone-6bd3e7bb
npm ERR! fatal: could not create leading directories of ‘/root/.npm/_cacache/tmp/git-clone-6bd3e7bb’: Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-25T16_28_34_537Z-debug.log

Are you running as root or using sudo? Sorry. Setting up a new aquarium, so my mind is a little divided at the moment. Make sure that all the commands you run are either as root (NOT RECOMMENDED) or using sudo.

So, a couple of things. On the Pi, there’s a known problem with npm being the latest version, so make sure you run sudo npm install npm -g" (you might have to run it twice).

Then, sudo /var/lib/harmony-api/script/bootstrap.

That should get you up and running.

1 Like

yes, I had already done this way, I tried both root and sudo.
I have however tried again, but I always have this error:
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b for-harmony-api git://github.com/maddox/harmonyhubjs-client.git /root/.npm/_cacache/tmp/git-clone-ff7bf79e
npm ERR! fatal: could not create leading directories of ‘/root/.npm/_cacache/tmp/git-clone-ff7bf79e’: Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-25T17_42_32_165Z-debug.log

Can you post the log (or at least tail the last 50 lines)?

I just installed the api on my RPI3 tonight and got it working after a lot of trial and error. I did one additional step… after

sudo script/install-linux
run
script/upgrade

You’ll also need to re-do the config.json file.

cd config
mv config.sample.json config.json
sudo nano config.json

replace that file with

{
	"enableHTTPserver": true,
}

or, if you have more than one Harmony hub, you can use something like

{
	"enableHTTPserver": true,
	"hubs": [
		{"name": "Living","ip": "192.168.0.xxx"},
        {"name": "Office","ip": "192.168.0.xxx"}
	]
}

Hope that helps. Now, I need to get my devices set up in WebCore…

whereI find the log?

Sorry what are the repo settings?

The log that was generated there.