Grab webcam picture into variable

Hi,

I have a rule that sends a picture via email when a door is opened. However, the picture is always a little late and misses the person opening the door.

My rule is like this:

 rule "send email with picture when door is opened"
	    when
	    	Item door_sensor changed from CLOSED to OPEN
	    then
	    	if (!lock_door.isLocked())
	    	{
	    		lock_door.lock()
	    		try{
	    			sendMail("email@example.com", "door opened", "http://192.168.0.X/jpg/1/image.jpg")
	    		     }
	              	finally{
	              		lock_door.unlock()
	                }
     }

I would like to grab the picture immediately and set it into a variable as I suspect that the “sendMail” procedure may be taking a lot of time to create the mail before the picture is actually grabbed, is there a way to do that?

Thanks

It does not look like it. Even if you could grab the image and put it into a variable there is no way to pass that to sendMail. It only wants a URL to the image.

You best bet will be, at the start of the rule to kick off some script or code to get that image and copy it to some other URL. Then pass that URL to sendMail.

Thanks @rlkoshak, that works.