Many different command on one item (harmony)

Hi, i’m looking to have many command on a single item. i want to use it with harmony binding so on item tv it could have the command : on, off volume up, volume down, etc… it would be so much simpler with rule after that if i could do something like : sendCommand ( TV, VolumeUp ) or sendCommand ( TV, ON) instead of having a different item for each button

is it possible ? I think we could map many button on a single item on sitemap but i need to do that in item file to re use it in rule !

I don’t completely know if I understand what you are asking for but if I do understand, you can get the behavior you want using a String or Number Item and a Switch element with Mappings on your Sitemap. Then, as suggest, have a Rule that interprets the value and sends the command.


String TV_Control "Controls"


Switch item=TV_Control mappings=["VUP"="Volume Up", "VDOWN"="Volume Down", "CHUP"="Channel UP", "CHDOWN"="Channel Down"]


rule "Process TV commands"
    Item TV_Control received command
        case "VUP": TV.sendCommand(VolumeUp)
        case "VDOWN": TV.sendCommand(VolumeDown)
        case "CHUP": TV.sendCommand(ChannelUp)
        case "CHDOWN": TV.sendCommand(ChannelDown)
1 Like

hum i don’t know if it’s what i need … :confused: could i use that with harmony binding ?

This is binding independent. You can use it with ANY binding, or no binding at all.

If what you are really getting at is a way to do the above just in the Items definition, that cannot be done.

I’m sorry I need an exemple …

how can i do it whit this :

String CHLedOFF “Led Chambre Off” { harmonyhub=">[Chambre:press:37331593:PowerOff]" }

If you’re still on OH1 then you’re probably out of luck.

Using the OH2 binding you can do something like:

String HarmonyGreatRoomDenon            "Denon Button Press" { channel="harmonyhub:device:GreatRoom:29529817:buttonPress" }

and then create sitemap widgets like:

Switch item=HarmonyGreatRoomDenon mappings=["Volume Up"="Volume Up","Volume Down"="Volume Down"]

The OH1 binding supports sending the button press command in the sitemap much like @danielwalters86 showed for openhab2, so for example:

Items File
String HarmonyHubCasitaYamaha "Yamaha" { harmonyhub=">[HarmonyHubCasita:press:Yamaha AV Receiver]",autoupdate="false" }

Sitemap File
Switch item=HarmonyHubCasitaYamaha label="Volume" mappings=[VolumeUp='+', VolumeDown='-']