motionEye image snapshots garbled

Hi,
My openHAB 1.8.2 runs on a RPi 2. Also, another RPi 2 runs motionEye software (latest version 20160221) with an attached RPi camera.

In the rules file, this piece of code is sending email to me with the attached image snapshot:

val ListCamSnap attachmentUrlList = newArrayList(
http://192.168.1.111/picture/4/current/?_username=admin&_signature=a0b4a8ef… etc.”,
sendMail(mailTo, “openHAB RPi image.”, message, attachmentUrlList)

The URL in the above line is what motionEye provides for a snapshot. It works fine every time if I try the same URL in a browser.

However, I get the email from openHAB, but 90% of time the image is garbled (looks like a modern painting :slight_smile: ).

I tried to experiment with different image resolutions in motionEye, but with no luck.

I want to implement this as an action after motion is detected with a zwave motion sensor configured in openHAB, but this poor reliabiity is unacceptable.

How this can be tuned to get clear images all the time ?

I am new to openHAB and any suggestion would be appreciated.

I get the same thing. I modified my rule.

rule "MotionDetected"
when
        Item PorchMotionDetected changed from OFF to ON or
then
    val url = "http://192.168.2.97:8765/picture/2/current"
    val outputFile = "/srv/data/openhab/snaps/" + now.toString +".jpg"
    var cmd = "curl -m 10 -o " + outputFile + " " + url
    executeCommandLine(cmd)
    Thread::sleep(1000)
    sendMail("jason.brunk@gmail.com", "Motion", "There is motion", "http://192.168.2.97:8765/picture/2/current")
end

I found that the screen caps were not garbled if I was watching the stream at the same time. Not sure why. But it was clear if someone was watching the stream. So I thought to try maybe grabbing a screen to “kick start it” before attaching to email.

I have it grab a screencap, wait 1 second. send a snap. Seems to work. I tried to grab a cap, store local then send. But that one was garbled too. Happened even if I ran the curl command by hand. 1st one garbled. 2nd was fine.

Hope this helps you out

Sorry for the delay, my RPi was not operational.

I tried the workaround and it worked :slight_smile:

@crankycoder, thanks a lot.

1 Like