[Release] Logitech Harmony Hub Driver v0.1.20230311

First off, thanks @ogiewon . This is absolutely brilliant--It's very reliably and it's fast! Quick question; I added a new activity to my harmony hub. How do I add a new child device for the new activity?

You should be able to just click "Refresh" on the Parent device.

:+1: Thanks!

Just an update on the setup problem I had, the new parent driver fixed it.

Thanks @corerootedxb and @ogiewon !

2 Likes

Dan, do you think I should update to the new driver even though mine is still working OK on the latest Logitech firmware? Reason I ask is that, as you know, I am running a custom version of your original code to trap for home control buttons presses, so I would have to copy that part across to any new code. It's not a big job but I'm inclined towards the if it isn't broke don't fix it mindset at the moment.

In your case, I would just replace your existing 'initialize()' routine with the following one from the new version. It was the only change that was made, aside from comments. I am guessing you probably did not have to modify this routine in your custom version.

def initialize() {
    state.version = version()
    log.info "initialize() called"
    
    if (!ip) {
        log.warn "Harmony Hub IP Address not configured yet"
        return
    }
    
    if (state.remoteId == null) {
        httpPost(uri: "http://${ip}:8088",
                 path: '/',
                 contentType: 'application/json',
                 requestContentType: 'application/json',
                 //Logitech changed webSockets interface in 4.15.250.  Updated Origin and body cmd.
                 headers: ['Origin': 'http://sl.dhg.myharmony.com'],
                 body: '{"id": 1, "cmd": "setup.account?getProvisionInfo", "params": {}}'
                ) { response ->
             //activeRemoteId is the new property name instead of just remoteId.
             log.debug "hub remote id: ${response.data.data.activeRemoteId}"
             state.remoteId = response.data.data.activeRemoteId
         }
    }

/*    Original code for users on older firmware - need to make more elegant DGO 2019-02-20
    //Make sure we know the remoteId of the Harmony Hub
    if (state.remoteId == null) {
        httpPost(uri: "http://${ip}:8088",
                 path: '/',
                 contentType: 'application/json',
                 requestContentType: 'application/json',
                 headers: ['Origin': 'http//:localhost.nebula.myharmony.com'],
                 body: '{"id": 124, "cmd": "connect.discoveryinfo?get", "params": {}}'
                ) { response ->
            log.debug "hub remote id: ${response.data.data.remoteId}"
            state.remoteId = response.data.data.remoteId
        }
    }
  */  
    //Connect the webSocket to the Harmony Hub
    try {
        InterfaceUtils.webSocketConnect(device, "ws://${ip}:8088/?domain=svcs.myharmony.com&hubId=${state.remoteId}")
    } 
    catch(e) {
        if (logEnable) log.debug "initialize error: ${e.message}"
        log.error "WebSocket connect failed"
    }
}
1 Like

Oooooh I'd love to be able to capture the home control buttons for HE!

You can if you have a Hue bridge on your system.

Thanks Dan. I've just incorporated that.

1 Like

I do! I'll look into this tonight. Any pointers?

There are some posts in this thread about it starting at post 102. I have a modified version of Dan's code that traps either Hue scene or Hue bulb activation from the Harmony hub and activates a HE button press within the device driver. You have to set up your Logitech remote home control buttons in the normal way to activate either a Hue scene (If it's an Elite) or a Hue bulb (it it's anything else) . Then you have to watch the logs when you activate them and copy part of the string across to the device driver code. Have a read of my earlier posts and if you fancy a go I will gladly PM you my driver code for you to customise to suit your specific codes. It sounds a bit complicated but once set up mine has been working flawlessly with both Elite and now Companion remotes.

It does mean having a "dummy" Hue bulb or bulbs. If you have an Elite you can uses 4 different scene names for one dummy bulb, if not you need a dummy bulb for each button you want to trap. I have my dummy one in the loft where it is useful as a repeater and doesn't cause a problem coming on.

1 Like

I just got a Logitech Harmony Companion
during set up it was updated to firmware 4.15.250. I couldn't stop that, I hope that's not a big deal
Any help is appreciated, I did add some of my devices along with Hue lights. I'm not sure what to set up first and then how to do the integration with Hubitat
Thank you again

No worries about the version. The latest version of my Harmony Hub integration works fine with the latest version of Harmony firmware.

If you read the first post in this thread, the instructions are provided. Let me know if you have any questions and I'll try to assist.

Personally, I would remove the Hue lights and anything else that will be controlled by your Hubitat hub from your Harmony hub. The reason I say this is you basically have two "hubs" doing essentially the same thing; You have your Hubitat hub running rules and controlling devices. Then, you have your Harmony hub running activities which could contain devices already on your Hubitat hub (Hue lights). This overlap will get confusing once you start getting into the 50s or 100s of devices in your home and becomes a maintenance nightmare. I say this from experience. :slight_smile:

For me, the easiest setup is to designate the Hubitat as the master device for rules and devices. My Harmony hubs (I have 4 of them, one for each room that has media devices) control only media devices and IR devices (a couple of floor fans and two fireplaces) that I cannot connect to my Hubitat hub. When an activity from Harmony gets activated, I then have the Hubitat hub kick off various rules to control lights or whatnot depending on the activity that gets started or stopped (the Harmony activities get exposed as switches to Hubitat).

1 Like

But how do you use the smart home buttons on the harmony remote to turn on/off/dim hubitat devices?

For my use case, I don't. I use voice control for lighting and/or routines. I have the remotes with the controls on them, I have just never had a use case for them when I have integration with Roku and Plex that control the lights.

However, one could always add the Hubitat devices to Harmony (I think? Is there a Hubitat->Harmony integration?).

It's just for me, I always found it a maintenance nightmare (especially for Hue, Ecobee, SmartThings, etc) when something would kick off a light and I would have to track down which system issued the command.

I just really like having the dimming function on the remote buttons and on the elite screen

But if I could map those buttons to HE and have it do the work I would prefer that if possible

As I suspected, there is no Hubitat->Harmony integration. Perhaps it's something that could be submitted as a feature request.

Harmony isn't accepting new integration requests. Not a Hubitat limitation, it's a Logitech limitation

1 Like

Any have any luck modifying this to work with harmony devices? I cannot seem to get the command for PowerOn/PowerOff/PowerToggle right. For activities, this works great.