3 Mode switch not mapping correctly

I’ve got a 3 mode switch in my sitemap that I want to use to control my garden watering system. I want there to be a manual and automatic mode (On, Off, Auto) so the switch has 3 mappings. However, in my rules, I am having problems reading the state of the switch. Here’s what I’ve got in my files. Any suggestions?


Switch item=gardenControlProxy mappings=[auto=Auto,on=On,off=Off]


Switch gardenControlProxy "Watering Mode" <garden>
Switch gardenControlBound {mqtt=">[mosquitto:/home/garden/wateringMode:command:ON:1],>[mosquitto:/home/garden/wateringMode:command:OFF:0]"}


rule "Garden mode"
    Item gardenControlProxy received command
 if(gardenControlProxy.state.toString().equals("off")) {
     gardenTimer = false
else if (gardenControlProxy.toString().equals("on")) {
	gardenTimer = false
else {
	gardenTimer = true

gardenControlProxy needs to be a String.

Switch can only be ON or OFF. You cannot assign “auto” to a Switch.

1 Like

Yep, that did the trick!