Harmony Hub Binding- Monitor Actions?

I noticed on Kai’s blog here, in the description of the Logitech Harmony Hub binding the following:

The binding supports bi-directional communication with the hub, i.e. it can send commands as well as being informed about actions on the hub, e.g. triggered through a Harmony remote control.

I am primarily interested in the second part of this statement- having the OpenHAB server do something if a particular action is executed on the Harmony Hub. Essentially, I have a network (http) callable device that the Harmony hub can not control, but I can control via the http binding. When a given action is started on the Harmony remote, I’d like to send a command to that device. Looking though the docs for the Harmony Hub binding, I could not figure out if/how this might be done. Any thoughts would be appreciated!

Hi,

you can read the current activity from the hub.

String Harmony_Activity "activity [%s]" { harmonyhub="<[familyroom:currentActivity]" }

In the second step you have to create a rule that sends the http command to your device when the activity changed to the right one.

In the documentation it shows how to get the current activity of the hub like so:
String Harmony_Activity "activity [%s]" { harmonyhub="<[currentActivity]" }

You can have a rule that gets triggered off this like
rule "Harmony Activity" when Item Harmony_Activity changed then logDebug("Harmony_Activity changed", Harmony_Activity.state.toString) end

Does this help?

Thanks BrianOverflow and digitaldan. Yes, that makes perfect sense. Not sure how I missed that in the docs!

I’m working on this same issue (now under oh2 and a item channel= binding), and the Switch on my basic panel is working well. If I had a rule and put in “changed from X” instead of just “changed”, what would the appropriate values of X be? The string version of the option I want is “PowerOff”, but I don’t think “changed from” is expecting the string version of the state.

This rule works:
_Item Harmony_Activity changed

works, but none of these work:
_Item Harmony_Activity changed from POWEROFF
_Item Harmony_Activity changed from PowerOff
_Item Harmony_Activity changed from “PowerOff”

Thanks

Try Item HarmonyActivity received command PowerOff or maybe Item HarmonyActivity received update PowerOff.

I don’t recall off the top of my head which might work i’m afraid, but are possible fixes…?

Thankyou. That certainly works (Item HarmonyActivity received command PowerOff) . Any idea how to reproduce the desired logic of knowing when the current state has changed from PowerOff to something else, without listing all the other options as possible commands received?

Use a rule. (off the top of my head)

rule "Harmony Hub Action"
when
    Item harmonyHub received update
then
     if (harmonyHub.state == "PowerOff" ) {
do stuff
}
end

Where harmonyHub is linked to the harmony binding state thing, and harmonyHub.state ==“xxx” depends entirely on your own harmony hub setup.

Has anyone had success with this in OH2? I’ve set up this binding in OH2 and I can set the activity just fine but I’m unable to read the activity. Any help is appreciated.

Thanks,
Matt

Please post your setup. The OH2 binding is able to send and react to changes to the current activity.

Home.things file:

Bridge harmonyhub:hub:EntertainmentCenter[name="Entertainment Center", heartBeatInterval=1]{
device SamsungTV[name="Samsung TV"]
device OnkyoReceiver[name="Onkyo AV Receiver"]
device XboxOne[name="Microsoft Xbox One"]
device CableBox[name="Motorola DVR"]
device BlurayPlayer[name="Motorola DVR"]

}

EntertainmentCenter.items file:

String EntertainmentCenterActivity "Current Activity: [%s]"	{channel="harmonyhub:hub:EntertainmentCenter:activity"}

_default.sitemap file:

	Frame	label="Entertainment"{
	Switch	item=EntertainmentCenterActivity	icon="receiver"	mappings=[PowerOff="PowerOff", "Watch TV"="Watch TV"]
}

I figure I just set something up wrong but I think I’m missing what the error is.

Thanks,
Matt

Only notable difference is that I’m using the currentActivity channel so my items file would looks like:

String EntertainmentCenterActivity "Current Activity: [%s]"	{channel="harmonyhub:hub:EntertainmentCenter:currentActivity"}

That’s probably it. That was probably me misreading the documentation. The strangest thing though is that it works for sending commands but just not receiving updates. Thanks that should do the trick!