Harmony Hub + Openhab2

Using Openhab2, can someone give me a sample rule of how to use openhab2 with the harmony hub?

From what I’ve read in OH2, I do not need to set anything manually? Is that correct? No config file or items/things?
I just let it discover it in Paper UI and added it as a thing.

I have just one channel. So what would a rule look like to call this hub to say activate an “activity” i have programmed into the hub?

You have to manually code your activities in Items or use them in Rules. This will help you understand how to find your activities available through the REST API and set them up - https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.harmonyhub

Thanks. I saw that already. There are no “Rule” examples.
Theres a sitemap example, but I want to make a switch and when i trigger that switch, somehow call the activity that is in the harmony.

What would something like that look like?
rule "Harmony Bedroom Netflix"
Item BRHarmony_Nexflix received command

Some how call this { channel=“harmonyhub:hub:Bedroom:HarmonyHub:buttonPress” } with a saved activity “BedroomTVNetflix” <----this is the part i need help with…the actual rule and how to trigger it


Here’s how I did mine. I created an item linked to the activity channel:


Then in the rule you would just send the activity to the Item:


So for yours you need to find the right activity to for your NetFlix and send it in your rule to your item.

I hope that makes it a little clearer


So in your case for your rule you would then use an if/else check so that if your switch was turned on you’d send the NetFlix command and if off you’d send the “PowerOff” command.

You had me until the If/Else
I get the item part now and how to send it an activity.

So here’s what i have in the app.

There is an activity called BR Roku Netflix.
It will 1)Turn on TV 2)Set the HDMI switch to 2 and 3)Turn on Netflix on the Roku
Using Harmony you turn it on, it does that, you hit OFF it run the “end sequence” screenshot 2
Does doing “PowerOff” essentially run the “End Sequence”

I guess my point is this:
If i create an item: BRHarmonyActivity
To run that saved activity i would do:

If switch=on then(pseudocode here :slight_smile: )
BRHarmonyActivity.sendCommand(“BR Roku Netflix”)


The confusion is around Poweroff. How does it know what “end sequence to run” based on that command. Is it based on what is currently ON I suppose?


The PowerOff activity is the same as hitting the off button on the remote, which I assume executes the End Sequence. So your rule would be:

rule "Harmony Bedroom Netflix"
    Item BRHarmony_Netflix received command
   if (BRHarmony_Netflix.state == ON) {
      BRHarmonyActivity.sendCommand("BR Roku Netflix")
   } else {

You can also use a number item and load it with all your options and then use the Switch / Case method if you want to get fancy.

Selection item=BRHarmony_Actions label="Actions" icon="switch" mappings=[1="--", 2="Power Off", 3="FirstAction", 4="SecondAction"]

rule"Harmony Bedroom"
	Item BRHarmony_Actions received command
	switch BRHarmony_Actions.state {
		case 2 : BRHarmonyActivity.sendCommand("PowerOff")
		case 3 : BRHarmonyActivity.sendCommand("FirstAction")
		case 4 : BRHarmonyActivity.sendCommand("SecondAction")


So here’s the million dollar question…keeping the switch in sync with the remote/app.

Turn on with Openhab-sets switch to on which fires rule.

Turn off on the harmony remote…openhab switch is still ON

Openhab/Harmony App/Remote are out of sync.

Perhaps something like this:

rule “Harmony Activity Changed"
Item BedroomHarmonyActivity changed
sendMail(”******@gmail.com", “Harmony:Activity Changed”, "Harmony:Activity Changed: " + BedroomHarmonyActivity.state)

If (BedroomHarmonyActivity.state = “PowerOff” {


That’s one of the reasons I take mine back to a null value in my multi-select approach. What you defined above should work (you have typos in your sample and I’d suggest using the new item.postUpdate() command structure). Though you’d probably want to make your if statement

If(BedroomHarmonyActivity.state != "BR Roku Netflix") {

I have a Fire TV connected to Harmony. I created an item that uses the Fire TV Thing discovered through Harmony. For the dropdown item, I can control all keys except “Select”. Select key does nothing. maybe the text sent should be different? If I use the same “Select” from the TV dropdown then the TV sends the “Select” key thru HDMI and it works.