I set mine up using a sitemap and a rule (though you could skip the sitemap if you are using another interface and just setup the item and the rule). I don’t have mine in front of me, but basically (no promises that there are no typos ;-):
Switch item=HarmonySwitch
Rule "Hamony"
when
Item HamonySwitch changed
then
if (HarmonySwitch == 1) {
HarmonyActivity.sendCommand("TV")
} else {
HarmonyActivity.sendCommand("OFF")
end
For mine I used a selection element in my sitemap and used switch / case in my rule for different activities.
Thanks @rgerrans the works of course, did not thought about rules.
I had expected a more elegant way to do this directly within the item configuration but this seems not to be possible with OH2…