Grab webcam picture into variable


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"
	    	Item door_sensor changed from CLOSED to OPEN
	    	if (!lock_door.isLocked())
	    			sendMail("", "door opened", "http://192.168.0.X/jpg/1/image.jpg")

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?


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.