Foscam C2M save snapshot to SD card

I have a Foscam C2M Wifi camera and I’m trying to do something that I imagined would be simple: issue an HTML request to have the camera take a picture and record it on the SD card. That’s it. But all the camera seems to want to do is return the image to me in the response to the request.

The actual request is:

I tried using the setSnapConfig to set the save location to 0 (SD card):

Although I suspect it only applies to the motion capture snapshots.

Anyway, no sign of the images on the SD card. Is there any way to do this apparently simple thing?

You don’t want to do that by using a rule ?

What kind of rule? My idea was to use the request in a rule.

Ok. From your description I had the impression that you would like to do it in different way - reading it again I see that I have slightly misinterpreted it.

This should be one option:

var String Status = executeCommandLine( Duration.ofSeconds(5), "/usr/bin/curl","", "-o", "/path/to/store/your.jpg" )

An other one - to get the picture into an item / a variable is described in oH 3.1 Download an image from the internet and save into a item of the type Image - #4 by Bredmich which I use to retrieve the picture from my CAM and send it via telegram. This one would require modification to write the file to the SD card.

Other methods I haven’t tried.

I think I didn’t make clear that I was talking about the SD card of the Foscam, not the SD card of openHab. I would imagine that would be easier.

Sorry then I completely misunderstood your question.
I had a look into the Foscam users manual.
It offers two snapshot functions ( snapPicture, snapPicture2 ).
The first one should return a path to a picture.
The second one the image data itself.

The example for the first one in the docs is:


What is returned in your case ?

It just gives me a bit of HTML

<html><body><img src="../snapPic/Snap_20230118-174018.jpg"/></body></html>

which doesn’t correspond to an image on the SD card. It seems that you’re supposed to read this image and store it locally. It’s all oriented towards accessing the camera remotely. All I want is for it to store images on its SD card when I tell it to.

What does

return (if supported by your camera …)?

See c# - Foscam IP camera: get snapshot - Stack Overflow for an explanation why you cannot find the snapshots on the SD card.

Quoting the main interesting part of content Ap15e’s link points to :

To answer your question, it appears that Foscam saves the image in /snapPic/ path just for the time required to serve your request, and then deletes it. This is why it returns a 404 when you try to use the link in HTML page.

I’m not familiar with Foscam cameras, but if it’s true that the snapshots aren’t saved, you’d have to use an FTP server (hoping that the camera actually uploads the snapshots …).

I tried setSnapConfig but it doesn’t do anything. :man_shrugging:

I’ve seen that, but that’s just one use case. What I find staggering is that they haven’t considered the other use case. If nobody has a better idea, I think the only way to hack this is to use setScheduleSnapConfig to take snapshots at the times you want. Those, apparently, do get saved on the SD card, providing that setSnapConfig is used to set that as the location.