Can Harmony Remote control any of your openHAB devices?

Hi Sam,

I really like your solution as I have a macmini next to the TV working as a media center. I guess I can add FLIRC to that computer and listen to my Harmony Remote buttons presses as it’s always near the TV.
Could you be more precise about how openHAB can get that commands from Keyboard Maestro?

Thanks!

Sure, happy to share.

Flirc

In Flirc I click the keys I want to associate with the IR signal I am about to send

I select the Panasonic TC-P65VT30 “device” which I have already added to my Harmony (I also renamed it Flirc), I press the “vera link” button (though it could be any button).

Flirc flashes to say it has added it.

Keyboard Maestro

In Keyboard Maestro icreate a new macro and say I want it to be triggered by a “hot key”.

Click the mouse inside the “this hot key” box and then Keyboard Maestro is waiting for you to press the keyboard combination you want it to be triggered on. Using the Harmony remote press the button you just set in Flirc (vera link).

If the Flirc side of things is working, this should fill in the hot keys correctly.

Then in the “execute the following actions” part of the macro I add a new action and select “Execute Shell Script”

#!/bin/bash
curl --header "Content-Type: text/plain" --request POST --data "ON" http://192.168.1.222:8080/rest/items/Harmony_TV_to_Projector

OpenHAB

.items

You don’t need the hub configured, the item we sent the ON request to is a dummy item and is not linked to any binding.

String Harmony_Press_Projector_Off	"Projector Off"   (gAll)   { harmonyhub=">[press:34897415:Projector off]", autoupdate="false"}
String Harmony_Press_Projector_On	"Projector On"    (gAll)   { harmonyhub=">[press:34897415:Projector on]", autoupdate="false"}
String Harmony_Press_SamsungTV_Off	"Samsung Off"     (gAll)   { harmonyhub=">[press:SamsungTV:PowerOff]", autoupdate="false"}
String Harmony_Press_SamsungTV_On	"Samsung On"      (gAll)   { harmonyhub=">[press:SamsungTV:PowerOn]", autoupdate="false"}

Switch Harmony_TV_to_Projector  	"TV to Projector" (gAll)  
Switch Harmony_Projector_to_TV  	"Projector to TV" (gAll)   

.rules


rule "Switch the TV to Projector"
when
    Item Harmony_TV_to_Projector received command ON
then
    sendCommand(Harmony_Press_Projector_On, ON)
    Thread::sleep(1000)
    sendCommand(Harmony_Press_SamsungTV_Off, ON)
    Thread::sleep(1000)
    postUpdate(Harmony_TV_to_Projector, OFF)
end

So you can see in this case I am using OpenHAB to run a little sequence, the MacMini, PS3 and Freesat box have HDMI out into switch box, then the HDMI from the switch is split into two so the same signal is going to the tv and the projector at the same time.

This allows me to switch the display from TV to Projector without changing activity.

To do the same on the Harmony is very tedious, you can read how I did on the Logitech forum

Once you have the “when” bit triggered, you can do whatever you fancy using anything that OpenHAB can control.

Good luck.

Not sure which remote you have, does it have a touch screen?

###Just for kicks here is my rule that does something based on the Harmony Activity

String Harmony_Current_Activity  	"Activity"     (gAll, gRestoreStartup) { harmonyhub="*[currentActivity]" }
rule "Turn off Cinema Mode when powering off Harmony"
when
    Item Harmony_Current_Activity changed
then
    var String HarmonyState = Harmony_Current_Activity.state.toString()
    if (HarmonyState == "PowerOff" &&  Cinema_Mode.state==ON){
            sendCommand(Cinema_Mode, OFF)
    }
end

2 Likes

Thank you very much!!
I finally got it working, it’s a really great way of controlling openHAB and I have learned some new tricks, thanks!

Anyway, I used a simpler way to control simple switches, I just used:

#!/bin/bash 
curl --header "Content-Type: text/plain" http://localhost:8080/CMD?ventilador=TOGGLE

Is it correct or it might turn into problems using it as a “toggle”?

Finally, a Harmony remote related question: I have the new Harmony Companion:

which has some specific buttons for lights, dimmers and outlets but they are disabled if you don’t add a “home automation device”… but I don’t have any that Harmony understands… So, do you know a way to “enable” these buttons so that I can bind them to the “system” you have shared with me?

Thanks!

Cool, glad it worked out.

Toggles are tricky, I started using them at the start but there will be times when a command to openhab gets held up somewhere and you fire off another thinking it hasn’t worked. The Harmony Touch remote is nice as you have buttons to spare with the screen.

Note that ir signals are blasted out repeatedly and in quick succession. You can use a pause action in Keyboard Maestro if it is a bit trigger happy.

There is a great… well I say great, and it is great but it’s not without its quirks, bit of software on the Mac called Remote Buddy. You can use that to build custom menus and control software on the Mac.

I use remote budy for controling OH with my Harmony hub. The magic thing si it configure your remote as an ps3 remote on Harmony so it’s in bluetooth and toi CAN control it from almost any room or your house

Of course I know Remote Buddy, I own it since almost 7 years ago and I’m very happy with it. Since then I run Kodi (formerly XBMC) with my Macmini and used RB with the Apple Remote without any other input device, I mean, I have setup RB in a way that let me use the full computer (mouse, keyboard, etc) just with this remote.

Now I have added the Harmony Hub and I only have this remote to control the TV, Macmini and Music stereo… that’s why I would like it to control my “home automation devices” too, hehehe.

@Dominic_Bonneau, I already have the remote as an PS3 remote but I can’t use the “home automation buttons” with this “activity” so that’s why I would like to enable them somehow (here is the thread) where @sam is also helping me out.

Thank you both

Using the same method as the Flirc you can also create your own behaviours and actions, then setup custom menus in Remote Buddy. Because there will never be too many ways to turn lights on and off :slight_smile:

It’s exacly what I did !

great minds and all that :slight_smile:

Hi,
Must the String in the First line in the Rule too?
Is my First Time with OH.

My Rule is looking so:

String Harmony_Current_Activity “Activity” (gAll, gRestoreStartup) { harmonyhub="*[currentActivity]" }

rule “Gute_Nacht_TV_AUS”

when
Item Harmony_Current_Activity changed
then
var String HarmonyState = Harmony_Current_Activity.state.toString()
if (HarmonyState == “Amazon” && nacht.state==ON)
{
sendCommand(homematic_HM_LC_Sw1_FM_8677c139_MEQ0361878_1_STATE, ON)
}

end

Is it possible to Check the Rule in the Internet? Thanks

This is an Item definition and needs to be in a .items file in the items folder.

Hi,
Thanks die the quick Answer. But wy do don’t take the item the Harmony Binding? And can i Check the ruels somewhere in the Internet, like a Compiler?
Is the Rest from the Rule than ok? I am testing the rule dir a few days.
Thanks for help

Lars

I don’t understand the question. The way OH works is you have a Binding that knows how to talk to a device or technology, in this case Harmony.

You must create Items to represent these devices inside of OH. Items are defined in .items files in the items folder of your configurations folder.

Rules run when certain events occur, in this case when the Harmony_Current_Activity changes its state. Rules are defined in .rules files in the rules folder of your configurations folder.

No. The best you can do is to use Designer which will syntax check the rules as you type. But for logic errors the only way to check them is to run them and use logging statements to discover and solve the problem.

I assume you are asking whether you can make an HTTP REST call from a rule. Yes with the one limitation that currently the HTTP actions do not currently support making HTTP calls with a body.

Please see :

Hi,
Thanks gor all. I will Look tommorrow.

Herr is My Script without a extra Item

rule “Gute_Nacht_TV_AUS”

when
Item harmonyhub_hub_Wohnzimmer_currentActivity changed
then
var String HarmonyState = harmonyhub_hub_Wohnzimmer_currentActivity.state.toString()
if (HarmonyState == “Fernseher” && nacht.state==ON)
{
sendCommand(homematic_HM_LC_Sw1_FM_8677c139_MEQ0361878_1_STATE, ON)
}

end

Thanks gor help!!

Hi,

the first Thing will work! Thanks
No I want to mute my Harmony with a Item.

So I made a Item with this;

String HarmonyHubMute “mute” { harmonyhub=">[press:Samsung-Verstarker:MUTE]" }

But when I Put mute in the Body from the Rest API than the Item will change bute no mute :frowning:

When i use the Item “harmonyhub_device_Wohnzimmer_25713496_buttonPress” with the Body mute it will work.

I want to use the Desiger but it dosen´t work to, I use the Openhab2 on a PI. When i chose the Folder it doesen´t work.
I think the Problem is the missing config Folder in Verison 2.

Thanks

For OH 2 you must use ESH Designer.

Hi,

i have a Problem with a PowerOff rule.

rule "PowerOff_Amazon"
when
    Item Harmony_Hub.state.toString() changed from "Amazon" to "PowerOff")
then
    {
    sendHttpGetRequest("http://192.168.188.74/config/xmlapi/statechange.cgi?ise_id=64056&new_value=1")
    sendHttpGetRequest("http://192.168.188.74/config/xmlapi/statechange.cgi?ise_id=63013&new_value=aus")
    }
end

My first try doesn´t Work too…

rule "PowerOff_Amazon" 
when
    Item Harmony_Hub changed 
then
    var String HarmonyState = Harmony_Hub.state.toString()
    if (HarmonyState changed from "Amazon" to "PowerOff"))
    {
    sendHttpGetRequest("http://192.168.188.74/config/xmlapi/statechange.cgi?ise_id=64056&new_value=1")
    sendHttpGetRequest("http://192.168.188.74/config/xmlapi/statechange.cgi?ise_id=63013&new_value=aus")
    }
end

Thanks for Help…

Lars

The trigger on your first try is correct. The second one is incorrect.

The the first try’s mistake is the if statement. Assuming you have persistence configured on the item you need to do something like the following

if(Harmony state != Harmony_Hub.previousState.state)

I just tried in the above from memory so I might have it a little wrong.

I highly recommend using Designer and <ctrl><space> to help check and discover correct rule syntax as you type.

Hi,
Thanks for help. But both of my Rules doesn’t work.
Yes the Syntax but with the Desinger… I don’t Unterstand them. With Working Rules the Desinger habe Problems. Can you give me a Working Rule for my example than i have a example for the Syntax.

I’m using the HUE Emulation to control openHAB from Harmony Hub and Amazon Echo (Alexa)
This might be less flexible but it works fine.

I can use the Smart Home Buttons on the Harmony Remote
and trigger the same items from Alexa.

I can post my configuration if wanted?