Logitech Harmony Hub device code

Hue’s in there…
And that’s a bummer, as I’m sure someone could fix the current issues with the dang harmony device…

From the conversations I have had with support, I don’t expect them to fix anything until mid January. A lot of stuff is on hold until after CES.

1 Like

Yea, I meant one of us fixing the dang device…

I would like to take a look at the code too. Right now the integration on the ST side is not really that valuable to me. I have two hubs and they are both working with the limited functionality that is available. If you open a support ticket they will fix the port issue if you are having that. I was instructed by support that it was something I could do myself in the IDE, but I don’t have a port option under my harmony device.

Not having the port problem, I was hoping to subscribe to the hub to check currentActivity, value: “PowerOff” to help with my auto sleep mode junk…
CurrentActivity isn’t updating in the app tile or the IDE or an app I subscribed to the hub with for testing…

1 Like

Wow. That was exactly what I was going to do. Tie the harmony to my jawbone to create an automatic sleep timer. How far along are you?

1 Like

Just started dinking with it this morning.

This is what I’ve found out.
–The device doesn’t support polling, and activities selected with remote aren’t sent to ST in anything like real time, if they ever are.
–The device does have a refresh() function in the device tile, this works, and is also available for use in a smart app.
–It’s a few seconds delay between activity change and when the refresh() will return the new currentActivity.

So you can subscribe to the hub in a smart app, but you’ll have to have another device event call the refresh() function of the harmony device to get the latest activity.
Not sure if you’re following all this, I can post the little demo app I’m playing with, it’s just subscribing to a switch and the harmony hub, and then calling refresh() within the switch handler.
Seems to work, I should be able to do what I want with this method.

/**
 *  Logitech Harmony Hub Control
 *
 *  Author: SmartThings
 */

definition(
    name: "Logitech Harmony Event Handler",
    namespace: "mmaxwell",
    author: "Mike Maxwell",
    description: "subscribe to harmony activities",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/harmony.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/harmony%402x.png"
)

preferences {
		section {
			input "hm", "capability.mediaController", title: "Logitech Harmony hub", required: true, multiple: false
		}
        section {
			input "sw", "capability.switch", title: "Harmony virtual switch...", required: true, multiple: false
		}
}

def installed() {
	log.debug "Installed with settings: ${settings}"
	subscribe(hm, "currentActivity", eventHandler)
    subscribe(sw, "switch", sHandler)
}

def updated() {
	log.debug "Updated with settings: ${settings}"
	unsubscribe()
	subscribe(hm, "currentActivity", eventHandler)
    subscribe(sw, "switch", sHandler)
}

def sHandler(evt) {
	harmony.refresh()
	//log.debug "switch:${evt.inspect()}"
    log.debug "sw:${sw.displayName} val:${sw.currentValue("switch")}"
    log.debug "hm:${hm.displayName} val:${hm.currentValue("currentActivity")}"
    //log.debug "capa:${hm.supportedAttributes.inspect()}"
}

def eventHandler(evt) {
	def activity = hm.currentValue("currentActivity")
	log.debug "hmActivity:${activity}"
}
1 Like

Ha, update.
I hacked up my pollster instance with an additional preference list with capability refresh, added the harmony device to that list… (so now the tile at least is up to date, though it’s not used in any apps yet)
Done, Boom!

Created a virtual switch in ST, added that to all the harmony activities…
Now a I can add that as an exclusion (must be off) in the Good night, automatically perform when…
Jez, all that just to keep the house from going to sleep when the main AV system is on…

1 Like

hey @Mike_Maxwell is the above code still working for you? i see another topic @krelltunez was asking and so am i. if it is still polling/refreshing an accurate state of the harmony virtual switch…do you mind sharing? thank you much.

@rangelsammon
Yes, the virtual switches in my harmony activities are still working.
I haven’t needed to use pollster, harmony to St updates have been working corectly on their own for some time now.

sorry my misunderstanding but does this mean you are replying on the ST published harmony discovery app or the above app you wrote?

@rangelsammon , the ST app published apps. I’ve been using the stock ST harmony apps for some time and haven’t been having an issue with them.

How about the other way around? starting an activity with the Harmony Home remote (the basic black one in my case) and having that activity act upon smartthings? (lights, modes, switches)

I can’t for the life of me relink both worlds from the Logitech Harmony app (android)

ideas?

does the ST harmony app find and connect to the hub?
can you see the activities, and create the virtual activity switches in ST via the app?
from the harmony side did you authorize the ST devices you want to use in your activities?

yup, from ST I can access Harmony… but on the Harmony SETUP, ST is nowhere to be seen… I added a thread here somewhere… let me go find it…

This is it

so, harmony app, setup, add/edit devices, devices, and no smart things?
did it ever work?
I have an ultimate home.

1 Like

EXACTLY! (finally someone understands my prob…)

And yes… it was working until about 2 months ago… or maybe 3? sigh

I’ve had the Harmony integration since day one, it’s been tenuous to say the least.
Other than getting support fired up, and this sounds like a Harmony issue, not sure what else I can offer.
All I can say is that when you do get it working again, don’t mess with it. And by that I mean don’t mess with the integration other than device authorizations.

1 Like

I, too, was having good luck with the stock ST harmony smart app (keeping activity switches up to date with current status) until yesterday/today, when all has gone haywire again. Very disappointing.