[Release] Logitech Harmony Hub Driver v0.1.20230311

I found the right command sequence. I have to use the quoted form of the command as reported in the config, and because the escaping char needs to appear in the string, I had to double escape them.

 '{"hubId":"' + state.remoteId + '","timeout":30,"hbus":{"cmd":"vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction","id":0,"params":{"status":"press","timestamp":"0","verb":"render","action":"{\\"command\\":\\"PowrOn\\",\\"type\\":\\"IRCommand\\",\\"deviceId\\":\\"' + activityID + '\\"}"}}}'

I am trying to make this work with devices too, not just activities. My challenge now is to figure out a way to keep track of which child devices are activities, and which ones are devices. Then I will need a way also to make the correct PowrOn or PowerOn (PowrOn is WiFi power on, if I recall). One option is to maybe make them momentary buttons instead of switches, and enumerate all power commands as buttons. Thoughts?

I have all my Hue lights connected directly to my Hue Hub but controlled by Hubitat via the in built app. All rules etc are in Hubitat only. But, by linking the Hue Hub to my Harmony, you can also use the 4 home control buttons on the remote to directly control 4 Hue lights. The only issue with this is that it might take a minute or so, depending on settings in the app, for Hubitat to be updated with any change instigated by Harmony. If you need to do any other actions based on those lights turning on or off that might be an issue, but I just use the 4 buttons to turn on or off lights in the lounge where the remote is, so it is no problem. You can also use a mod to this Harmony Driver (see my posts earlier in this thread) to intercept the commands sent to Hue by Harmony and turn them into button presses within Hubitat.

1 Like

I would add something to the child Device Network ID to indicate if a child is a “device” versus an “activity”. To maintain backwards compatibility, I’d leave “Activity” children as-is, and just add a prefix or suffix to the “Device” children’s DNI.

So, apparently, since the remotes do not maintain state, neither do devices in harmony. We do not, and cannot receive on/off state from the hub. As such, I think it makes more sense for these to be a multi-button controllers, or simple buttons. Since we can enumerate all the supported commands for the remote, I can create a button for every option

1 Like

It's always been a shortcoming in Harmony hubs and one that I never understood why Logitech never "fixed". In order to maintain state of a device, you have to track it. I am doing that with NodeRed (as I find that global and session variable management is a bit easier than on the HE hub).

Just got my HE today and wanted to jump right in. Great thread and even better documentation. Had my Harmony Hub working in HE in 5 minutes. Looking forward to getting my hands dirty.

3 Likes

Quick question - does this driver support multiple Harmony hubs?

I have one downstairs and one upstairs. I know Google home does not natively support two different hubs, but I'm curious if using virtual switches in HE can be a workaround to that problem.

1 Like

It sure does! Just add a second "Virtual Device" and assign it this driver type. Edit the preferences and you should be good to go.

2 Likes

@ogiewon

Did any development to support device control happen yet? I just purchased a Xiaomi Magic Cube and I would like to have it control volume by spinning the cube, channel UP/Down by going to side 2/5, etc.

I have not added Harmony Device support, nor am I actively developing that functionality at this time. If someone else wants to add this functionality, I am always willing to accept pull requests.

I am willing to work on this. :slight_smile:

Do you have any insight on the information coming back from the hub? In your code is there somewhere to see the full json response?

@armand

Have you figured out a way to query devices/capabilities from the Hub?

When the config is requested, all activities and devices are returned in the json response. I simply focused on the Activities in the parse Routine.

Simply uncomment the second log.debug below to see the full json string.

def parse(String description) {
    //log.debug "parsed $description"
    def json = null;
    try{
        json = new groovy.json.JsonSlurper().parseText(description)
        //log.debug "${json}"    
        if(json == null){
            log.warn "String description not parsed"
            return
        }
    }  catch(e) {
        log.error("Failed to parse json e = ${e}")
        return
    }

If you click REFRESH, the config from the Harmony Hub is requested, and you’ll be able to see the massive json response.

Sorry if this has already been covered (I couldn't see it had)

Is it possible for hubitat to see button presses from the harmony. I am desperately looking for a solution for light changes based on the play /pause / stop state of a media player. I used this successful with Plex and smartthings but I want to achieve something similar with streaming services such as Netflix and Amazon. Home assistant has a "media player" module that works with Roku and I think provides this functionality. Has anyone implementated something similar with harmony (or anything else)? I know that we can change the lights when an activity is triggered but I am looking but at triggers when media is paused / stopped.

Currently @ogiewon’s awesome driver only support activities. I have been working on a Harmony devices but will only be focusing on Televisions and Audio Receivers for the first go around. I need it for specific functionality I am attempting to do through the Magic Cube. :wink:

Look into the HubConnect app from @srwhite. It will allow you to sync/push HE devices to SmartThings so that you can then use the ST Harmony Hub integration to get your home control buttons working on your remote.

I was seeking a solution for being able to use some of my dimmers/lights with my 2 Harmony remotes' home control buttons. I use the HubConnect app to push 4 sets of lights/dimmers to ST, which I still use for it's native Harmony Hub integration.

My ST hub sees the lights/dimmers from HE and I configured the Harmony Hub ST integration to use those lights. Doing so allowed me to set the home control buttons on my Elite and Companion remotes to control those lights/dimmers. One press turns on the lights. A press and hold turns them off. And, the best part, is that the up/down toggle button controls the dimming.

Once you set this up, you can also use your lights with play, pause, stop, etc.

1 Like

Many thanks for the replies. Sounds like a great setup - but I got lost at the end!

From what I can see - set up harmony on ST and use hubconnect to push to HE. What is the process to actually link to play/pause etc?

Many thanks!

You do that in your Harmony remote setup. Once you have HubConnect setup and ST sees your HE lights, setup the Harmony Hub integration on ST. Tell the integration to use whatever lights you want from ST.

Once that is done, go into your remote setup and configure the play, pause, stop, etc. buttons to do whatever you want with your lights. You are basically editing the existing button commands to add a command to turn on, dim or turn off your lights.

For example, I have my play button turn off all lights when a blu-ray starts or a movie starts in Apple TV. My pause button pauses the movie and raises only one set of lights to 25%. Stop button stops the movie and turns all lights back on.

You can also setup the Home Control buttons if your remote has them.

Thanks for this - I had no idea you could customise buttons like that in Harmony. I’m almost there but the issue I am having is when I try and edit the remote (e.g for an Amazon Fire Stick), and use a sequence, it does not show Smartthings / Lights under the devices. I can see the lights in Harmony and control then seperately, but not as part of a sequence! Any thoughts would be appreciated!

Seems to be a similar issue to here. Have things been updated since then? Forums