Simplify thing / item configuration for HDMI Switch

Please How to use code fences

How do you represent these on your sitemap? How do you want to? For example, to follow Dave’s suggestion you can use:

Switch item=HDMI_Switch label="HDMI Control [%s]" mappings=[port0R="One", port1R="Two", port2R="Three", port3R="Four", port4R="Five"]

That will give you one element on the sitemap with four buttons labeled One, Two, Three, or Four. When you click one of the buttons it will send “portXR” as the command to the Item where X is the number of the button pressed.

I’m assuming that nothing happens when you set your existing HDMI_Switch Items to OFF.

Create HDMI_Switch as a String Item. And in fact, link that Item to the Channel that sends the command since the message is already what the device needs.

Then create a single Rule:

rule "HDMI_Switch"
when
    Item HDMI_Switch received command port0R
then
    Kodi.sendCommand(OFF)
end

That’s it. You only have the one Item so you don’t need to maintain the states of five different switches. Telling which input is enabled will be apparent from the highlighting on the buttons on the sitemap. And you only do something different (turn off the Kodi) when the Switch 1 is turned ON.