Itach multiple ir commands and sitemap

I have created rules like the following item

rule “TV_CARTOONNETWORK”
when
Item TV_CARTOONNETWORK received command
then
if(receivedCommand == ON) {
GC100_IR_ITV.sendCommand(“GC100_IR_ITV_6”)
GC100_IR_ITV.sendCommand(“GC100_IR_ITV_0”)
}
end

This works fine but now I would like to have them in my sitemap visualised as buttons
like
Switch item=GC100_IR_ITV label=“TV Kanaal[]” mappings=[GC100_IR_ITV_1=“NPO1”, GC100_IR_ITV_2=“NPO2”, GC100_IR_ITV_3=“NPO3”, GC100_IR_ITV_4=“RTL4”, GC100_IR_ITV_5=“RTL5”, GC100_IR_ITV_7=“RTL7”]
This works fine for the channels that have one “ir” command. I have them in the transform folder.
but I don’t know how to do it for the multi “ir” commands. Hope anyone can shine a light on this

You need to separate what you put on the sitemap from what sends the commands to the IR commands. This is called a Proxy Item.

Make the Proxy Item be a String Item and this is the Item that you put on your sitemap.

When the Proxy Item receives a command trigger a Rule. In the Rule check what channel was selected and issue the command or commands that correspond to that channel.

do you mean something like because I don’t understand it completely

PTV_ CARTOONNETWORK is a new item which triggers the rule TV_CARTOONNETWORK

string item=PTV_ CARTOONNETWORK mappings=[TV_CARTOONNETWORK =“CN”]

Item:

String TV_Controller

Sitemap:

Switch item=TV_Controller label=“TV Kanaal[]” mappings=["Cartoon Network"="Cartoon Network", ...]

Rule:

rule "TV Control"
when
    Item TV_Controller received command
then

    switch(TV_Controller.state.toString){
        case "Cartoon Network": {
            GC100_IR_ITV.sendCommand(“GC100_IR_ITV_6”)
            GC100_IR_ITV.sendCommand(“GC100_IR_ITV_0”)
        }
        case "HBO": {
            GC100_IR_ITV.sendCommand(“GC100_IR_ITV_5”)
            GC100_IR_ITV.sendCommand(“GC100_IR_ITV_3”)
        }
        ...
    }
end

this worked perfect for me thnx alot :slight_smile:
What i would like to do now is to create buttons that adapt to the screen
i have the folowing in the sitemaps

Frame label=“TV Zenders”{
Switch item=TV_Controller label="[]" icon=none mappings=[NPO1=NPO1, NPO2=“NPO2”, NPO3=“NPO3”, RTL4=“RTL4”, RTL5=“RTL5”, SBS6=“SBS6”, RTL7=“RTL7”, RTL8=“RTL8”, SBS9=“SBS9”, VERONICA=“VERONICA”, NET5=“NET5”]
}
Frame{
Switch item=TV_Controller label="[]" icon=none mappings=[ID=“ID”,BBCFIRST=“BBC FIRST”, RTLZ=“RTLZ”, BBCONE=“BBC ONE”, BBCTWO=“BBC TWO”, CARTNET=“CARTOON”, DISCOVERY=“DISCOVERY”, MTV=“MTV”]
}
Frame{
Switch item=TV_Controller label="[]" icon=none mappings=[SPIKE=“SPIKE”, FOX=“FOX”, TLC=“TLC”, DISNEY=“DISNEY”, XITE=“XITE”, EEN=“EEN”, CANVAS=“CANVAS”, KETNET=“KETNET”, VICELAND=“VICELAND”, INSIGHT=“INSIGHT”]
}
Frame{
Switch item=TV_Controller label="[]" icon=none mappings=[24KITCHEN=“24KITCHEN”, ZENDERMAAND=“ZenderMaand”, HISTORY=“HISTORY”, NICKELODEON=“NICKELODEON”, LOVENATURE=“LOVENATURE”, EUROSPORT=“EUROSPORT”]
}
This works fine on my ipad but it screws up on the iphone. The screen is to small. Is there a way that dynamically adapts to the screen or another way to line up the mappings

No. the text/mappings are limited to one line. If you have that many mappings, you might consider using a Selection instead.