Switch case not triggering

I got a webcam in my garage, where I have made an item to control its position, so I can rotate it.

When I split the rule up into more individual rules for each position value, it works fine, but when trying to make it a bit more compact, it stops working again. Can anyone see my error?

String GarageCamPosition “Target” (garage, camera)

Switch item=GarageCamPosition mappings=[0=“Car”, 1=“Door”, 2=“Table”]

rule “Garage cam position”
Item GarageCamPosition received command
switch(receivedCommand) {
case 0 : sendHttpGetRequest(“http://openhab:password@ip/decoder_control.cgi?command=31”)
case 1 : sendHttpGetRequest(“http://openhab:password@ip/decoder_control.cgi?command=33”)
case 2 : sendHttpGetRequest(“http://openhab:password@ip/decoder_control.cgi?command=35”)

2015-11-07 16:20:02 - GarageCamPosition received command 1
2015-11-07 16:21:20 - GarageCamPosition received command 0
2015-11-07 16:21:45 - GarageCamPosition received command 2
2015-11-07 16:21:47 - GarageCamPosition received command 1
2015-11-07 16:22:15 - GarageCamPosition received command 0

Kinda solved, I got it to work like this instead


Switch item=GarageCamPosition mappings=[31="Car", 33="Door", 35="Table"]


rule "Garage cam position"
	Item GarageCamPosition received command
	sendHttpGetRequest("http://openhab:password@ip/decoder_control.cgi?command=" + receivedCommand.toString)

It might even be a better solution, but still, I would like to know what I did wrong the first time, so will wait a bit to add solved to the title. :smile: I will no doubt run into another scenario where the switch case would be handy to use.

Disclaimer: I use JSR223/Jython rules so I may be way off here, but here is a wild guess…

The GarageCamPosition is a String item, but the switch statement cases are looking for integers. In the working rule, you are using the command as a string so it’s not a problem.

I followed the post, but the camera (foscam) does not take command
in the rule I entered so:
sendHttpGetRequest (“http: //ipaddress: portnumber / decoder_control.cgi? command = 39”)

while directly from the browser it works
some idea?
thank you