[SOLVED] Problem sending IP-CAM snapshot with pushover (Wansview 1080)

Hello together,

If have read through several threads of this forum and been searching the internet for several days – still no solution in sight.

I have two Cameras in my House, one INSTAR 9008 and one WANSVIEW 1080p. My goal is to send snapshots via PUSHOVER to my phone. For the Instar this was no big problem and is working now. The Wansview is resisting my demands until today :frowning:

I looked up and tried several different snapshot URLs from the internet and the user manual – without success. When I use Chrome with one of the URLs, I get a snapshot shown, so I suspect the executeCommand to save the file to /tmp to not be working properly…
I also used different commands (wget, curl) for saving the files - didn’t work either.

A file “Durchgang.jpg” is available, as i placed a dummy at the specific location. The dummy is sent via pushover but never changed by the rule/camera.

I have the IPCAM bining installed, but it shouldn’t be required for this purpose, right? As I understood the image item is endcoded somehow and cannot easily be sent as an attachment.

Has someone else had the same problem or can point me in the right direction?
(I am using latest openhab/openhabian 2.4 on raspberry pi)

Is any additional information required (i’m posting for the first time here :wink: )

My rules:

INSTAR (working)

rule "Briefkasten Snapshot"
when
    Item XI_WDS_EG_BRIEFKASTEN_Status changed from CLOSED to OPEN
then
    var FrontDoorCam = "FrontDoor.jpg"
    var Location = "/tmp/"
    executeCommandLine("wget http://192.168.2.151:80/tmpfs/snap.jpg?usr=admin&pwd=********* -O " + Location + FrontDoorCam)
    createTimer(now.plusSeconds(1),  [ |
        sendPushoverMessage(pushoverBuilder("Briefkasten").withTitle("Die Post war da").withAttachment("/tmp/FrontDoor.jpg"))
    ])
end

WANSVIEW (not working)

rule "Wansview Snapshot"
when
    Item TestSchalter changed from OFF to ON
then
    //http://username:password@ipaddresse/mjpeg/snap.cgi?chn=0
    //http://username:password@ipaddress:port/mjpeg/snap.cgi?chn=0
    //http://username:password@192.168.2.112:554/mjpeg/snap.cgi?chn=0
    //http:/username:password @192.168.2.112/tmpfs/auto.jpg?

    //executeCommandLine("curl --user admin:********* http://admin:*********@192.168.2.112:554/mjpeg/snap.cgi?chn=0 --digest -o /tmp/Durchgang.jpg")
    //executeCommandLine("wget --user=admin --password=********* http://192.168.2.112:554/mjpeg/snap.cgi?chn=0 -O /tmp/Durchgang.jpg")
    executeCommandLine("wget http://192.168.2.112:554/mjpeg/snap.cgi?chn=0 -O /tmp/Durchgang.jpg")


    createTimer(now.plusSeconds(1),  [ |
        sendPushoverMessage(pushoverBuilder("Bewegung erkannt").withTitle("Kamera Snapshot: Durchgang Garage").withAttachment("/tmp/Durchgang.jpg"))
    ])
end

LOG (when the item change is received)

2019-06-27 23:40:52.713 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine 'curl --user admin:********* http://192.168.2.112:554/mjpeg/snap.cgi?chn=0 --digest -o /tmp/Durchgang.jpg

Thanks a lot

Give the executeCommandLine a second argument, which is the maximum number of milliseconds to wait for the command to complete. Without that, the executeCommandLine immediately returns and you do not get any feedback from the result of the command, including errors.

Then assign the result to a variable and log that out so we can see the result of the wget. This will be how you will see errors. This will also make it so you don’t need the Timer

You might need to replace all the spaces with @@.

See How to solve Exec binding problems.

A few comments.

Port 554 is normally for RTSP streams and it is weird you are trying to use it for a snapshot, I could be wrong and the camera may use that but I suspect the port is wrong and the fact you have listed so many urls indicates you are not sure what url will work with your camera. Use a browser first to confirm which one works.

Cameras like Instar are easy to use direct in Openhab due to their ability to use user and pass in the url string. If the camera uses digest or basic auth the best way is with the IP camera binding it will handle it all for you and can provide a snapshot for you to use. The binding will also help you to create an animated GIF that moves in your pushover message and the readme covers this and more like snapshots, as do the more recent posts in the thread for the binding.

Thank you very much!!!

Adding a timeout allowed a proper log and this revealed a permission issue:

2019-06-28 21:29:27.573 [INFO ] [ipse.smarthome.model.script.execTest] - /tmp/Durchgang.jpg: Permission denied

After changing permissions writing the image worked and so the pushover attachment.

Strangly, for the Instar rule, this was not necessary?! The owner of the instar image is “openhab” and for the wansview image it’s “openhabian”

Nevertheless, it works now.

Thanks again!

Thanks Matt, you are right, the port 554 is for RTSP. I tried also 80 before, the 554 was just the one I tried last.

But as stated above, my issue was permissions for the image file.

As sending an image now works, I will definitly also look deeper in the IPCAM Binding and GIF creation - sounds interesting.

thanks!