You could use a number Item with mapping in the UI:
.items
Number My3stateSwitch "State is [MAP(3states.map):%s]"
.sitemap
Switch item=My3stateSwitch mappings=[0="OFF",1="ON",2="AUTO"]
transformations/3states.map
0=OFF
1=ON
2=AUTO
.rules
rule "3state"
when
Item My3stateSwitch changed
then
switch (My3stateSwitch.state as DecimalType) {
case 0 : MyItem.sendCommand(OFF)
case 1 : MyItem.sendCommand(ON)
case 2 : {
//put auto code here or trigger another rule to execute auto code
}
}
end
Of course, since the UI draws three different buttons you don’t need the 3state.map and the dynamic label for the switch, it’s a matter of taste (is this correct? Maybe there is an idiom)