Harmony Hub Integration

Harmony is the only thing I have left in ST get it working and I would be golden.

Early adopters, here is a very basic Logitech Harmony Hub integration for Hubitat. The install and configuration is manual, but it does appear to work in my limited testing over the past 24 hours.

You will need to get the harmony-api server up and running on another system on the same LAN as your Harmony Hub and Hubitat Elevation hub. I did this on a Raspberry Pi that I also use for Homebridge.

Here is the ReadMe from my Hubitat GitHub repository that should help get you started. Let me know how it goes. If you want to help improve the ReadMe, please feel free to submit a pull request with you edits.

4 Likes

Arggg…now I have another App to try tonight. My wife is not gonna be happy…but I will be if this works.

Thanks in advance…and if this works…I’ll have just one integration left to be all in. Huey, Huey…Where art thou? Me thinks @patrick can find him.

2 Likes

I just update the “HTTP Momentary Switch” driver as I noticed that these devices would sometimes get stuck in the “on” state, which should never happen by design. I have modified the code and revised my GitHub repo accordingly.

Although this is a cloud to cloud solution, it works until a local solution is finalized.

Control Hubitat from Harmony Activities

  1. Setup Hubitat SmartThings Integration

  2. Create a simulated switch in SmartThings

  3. Use Rule Machine in Hubitat to assign actions based upon the virtual switch turning on.
    Note: So the virtual switch in Hubitat is ready to activate again, set a rule to turn it off after a 1 second delay.

  4. From the Harmony App > Harmony Setup > Devices - Authorize connection to SmartThings and enable access to the virtual switch in SmartThings.

  5. Create an activity (Ex. Dining Room OFF) and set the home controls to turn the virtual switch on when the activity starts. This could also be assigned to an existing activity, and as a second example, you would have the virtual switch trigger a rule via RM that dims your lights when the Harmony activity starts.

You can also go the other direction if you need to - Control Harmony from Hubitat

  1. Setup Other Hub

  2. Install the Logitech Harmony Trigger SmartApp in SmartThings (Marketplace > SmartApps > + More)

  3. Using the Logitech Harmony Hub Control SmartApp, configure it to react to the state of your virtual switch, which is linked to your OH switch in SmartThings, and it will now start a Harmony activity.

2 Likes

I was interested in the harmony-api with KuKu since it runs locally but I haven’t had a chance to get it setup on my Pi.

But! I did get the native SmartThings Harmony (Connect) SmartApp and Hub/Activity DTHs ported over. Main issue is getting OAuth setup since I don’t have an API key and I’m not sure if Logitech is going to respond to my request for one. In the meantime the auth tokens can just be copied over from SmartThings after it’s successfully authenticated there. There isn’t any refresh or expiration on the tokens from what I see. Only if the account password is changed or they’re otherwise revoked. So once it’s setup once, it should continue working without any intervention. Disclaimer: This might be against TOS somewhere, but seems to be an open API if you have an auth token.

  1. Login to graph.api.smartthings.com
  2. Click My Locations > smartapps > Logitech Harmony (Connect)
  3. Save both HarmonyAccessToken and accessToken (easy to confuse by name)
  4. Install both drivers and app from github here.
  5. On the Manual Authentication step, paste the two values copied from the ST install.
  6. Hubs/Activities should be found. The page refreshes every 15 seconds during setup so they might not show up right away.

Luckily there weren’t too many code changes required. Obviously the OAuth entry changes and also needed to modify the asynchttp methods to the regular synchronous ones. I think there’s possibly an issue with Hubitat’s sendEvent isStateChanged handling. Repeat events should be handled automatically, but each time polling is called (every 5 minutes) there’s a log entry even if the state hasn’t changed. I added in a check for the activity switch status to prevent this for now.

This is still a cloud connection to Logitech’s servers so not completely local yet, but at least a start and not requiring any extra hardware.

Let me know if it works for you!

9 Likes

Thank you so much! That works great. I tried my “goodnight” activity, which turns off my Insteon lights downstairs and my entertainment system. Worked perfect!

1 Like

KuKu Harmony is working in Hubitat now. There is a ton of code that needs to be cleaned up, but you can get the code from here:

2 Likes

May I suggest you add this to the Code Share category and tag it as a Community_app.

2 Likes

One thing I used in ST integration was the ability to tell set a specific Harmony Hub “all off” so that all activities were terminated. I do see the “all off” command in the hub device in Hubitat, but I don’t see a way to call it via a “switch” using RM?

That’s a pretty good idea. I modified the Hub driver to add switch capability and mapped the off() command to alloff(). This seems like a pretty safe change and should make it easier in RM to call off as a switch, since by default the Hub driver doesn’t have any compatible capabilities to have it show up in the custom commands selection. Just FYI on() command doesn’t take any action. The changes are up on Github.

1 Like

Thanks Matt! That will make it easier for sure.

Sorry to bother, not seeing the update in github, or at least it’s not showing a new commit?

Sorry I forgot to sync the repository. It should be up there now.

1 Like

Thanks

Works great @mattw.
@ogiewon, have you tried this Logitech Harmony Connect port? It works great and you don’t have to schedule a RPi reset every 3 days :wink:

2 Likes

Morning All. Going through more fun stuff to integrate and today I am onto Harmony!

I would like to use the momentary https switch. Doing so will require me to install the maddox harmony-api.

I am NOT suing RPI but rather synology docker which provides a GUI interface for the install.

Does anyone have experience with this.

In particular selecting the correct volume will enable the installation and loading of the api correctly.

PS - that is NOT the correct directory.

@mattw and @stephack

I just got around to trying Matt’s amazing port of the ST Logitech Harmony integration. This works very well.

So, it looks like we actually have quite a few options for Hubitat/Harmony Hub integration. Due to the instability of the ‘harmony-api’ (I have to reboot the PI/Linux host every few days or else it seems to lock up), I will be using @mattw’s solution for now. While it is not 100% local/LAN, it does remove a dependency to run another server in my house.

Thank you Matt!

Dan

2 Likes

Did you already figure this out? I noticed that in addition to each of my Activities showing up as a device, my Harmony Hub also shows up as a device. You can easily turn OFF the Harmony Hub Device, which will stop any activity that is running. I was able to turn it off via Alexa, so I would hope it would work in RM as well…

One issue with the UI. The page refreshes before I can select all activities. I found myself in a click-race with the refresh.