How Can I Save a Snapshot Camera Image?

I have been using a Hubitat dashboard tile to view images updated every five seconds from selected cameras using an "image tile". This works great.

I have a motion detector external to the camera that I use in Hubitat that is super accurate. When it sees motion, I launch a web event to my QVR Pro that takes a snapshot of the camera and emails it to me. This works flawlessly.

I would like to find a way from Hubitat to store the image from this last motion snapshot somewhere. I use my camera snapshot URL to see a point in time snapshot.

I want to store this "latest motion JPG" to a web server or file service on my LAN and then be able to have an image tile representative of the "last motion". It would serve as a "last event capture".

I know the camera snapshot URL because I am using it in the dashboard today for real time periodically updated images. What I want is the ability to capture, store and ultimately display this image in a dashboard as my "last motion image".

My problem is that I have no idea how to save the image from the snapshot URL someplace. Does anyone have any ideas?

I have installed on a spare computer ispy (free). This software monitors, saves pics (timed or motion activated) locally and upload on a web server some pictures every 5 minutes with the same file name. I put on my dashboard the url of that image, like http://myownserver/pics/picX.jpg
There are other softwares that do the same, like blue iris I think ($)

I'm using Blue Iris with Deepstack AI that sends a snapshot to a defined destination every x number of seconds when motion is detected. However, depending on the type of camera you have, you should be able to do something similar within the camera's UI. Here's an example of Dahua's UI with the different options.

The local option uses an SD card for storage, but you could set this up to send the image to an FTP server or a local NAS.

And if you don't have/want an external website to ftp your pics, you can install on the very same computer a file server like HFS.

https://www.rejetto.com/hfs/

I have looked at Blue Iris before. I hear about iSpy out here in HE. Big question, are either of these products available in Linux?

I absolutely will never, ever run any Windows in my Network at all. I dove out of Windows in 2007 and I even have an isolated VLAN to help people who bring me their broken virus infected Windows junk. I reluctantly fix their Windows systems after I force them to suffer with my hour long speech on how I can improve the performance, reliability, and ease of use if they just let me upgrade them to Linux.

Ok, sorry for preaching. It looks like Blue Iris is Windows only. It appears that iSpy has a Linux "agent" but that the server is Windows only. Am I reading this incorrectly? Another reason I don't want the server to be Windows is that I want it to run in either LXC or in a Docker instance on one of my QNAPs. Not at all wanting a Windows virtual machine for the aforementioned reasons.

Blue Iris is awesome, but it is windows only.

@Vettester, I also want to send a snapshot image to my webserver, file share, or ftp site only when motion is detected via a Philips Hue motion detector. Ideally, I would most likely have a webcore piston initiate a web request upon detected motion that would then make a call to Blue Iris or iSpy and they would save the screen snapshot to the web server.

There should be a way to do this. I'm doing just the opposite by using Blue Iris to define motion detection and then this is integrated into HE via Maker API. This way I can use the camera motion as a trigger for other automations.

You are using QVR Pro which already does 90% of the work already. Look into the QVR Pro API and see it allows external trigger for snapshot then have HE trigger with a webhook or Maker API.

@Navat604 I have actually already been that route. You have to apply to QNAP for a developer license for the QVR Pro API. They want you to be a company actively developing a product.

What brand is your camera? It's possible your camera will support http trigger.

It is a GW Security. I have no problem with a SnapShot URL. I just have no idea how to store the Snapshot under program control.

Maybe puppeteer may be of use in this scenario. Instead of embedding the image, you can have a script save/store/rename the image to your liking.

Check out this thread in the sharptools forum.

3 Likes

Not sure which model you have but I see GW IP cam supports NAS, FTP and NFS for snapshot storage. Similar to my Hikvision.

Ive been wanting to solve this problem as well, and was motivated to come up with a proof of concept when this thread got started. I had some code from a previous project, and made this, which seems to work for my current needs and thought it may be helpful for others. This will help to centralize and archive image capture from your cameras on motion events, and reduce the strain on your cameras if multiple devices are requesting images from them on motion events.

There is a screenshot of the interface on github along with more details on how to use this. Let me know if anything needs more clarification or if there are any functionality requests.

The server side code is php as I have processes setup for easy development/production at home, but I may look at moving to nodeJS or something else more modern at some point. The interface is also using an outdated version of angularJS, but it has all local files/libraries and works well.

I have an iFrame device driver for hubitat in my github as well, which may be useful to easily add this interface to a dashboard if you dont just want the most recent camera image using the image tile + refresh function.

I am not sure that we are trying to do the same thing. The motion events on my cameras are generally always false indicators. In my particular case, I put a Philips Hue outside motion detector on my porch. The only false positives I get are very large bugs as opposed to the camera motion which detects shadows and blowing leaves.

So, in the case of my QVR Pro, it can email an image initiated by a web event. So, I have a Webcore piston in my HE which triggers the web call to QVR Pro whenever the Philips Hue outside motion detector sees motion.

This works flawlessly. The problem is that I would like to store the latest motion shot on a web server so that I can reference it from an image tile in a dashboard.

Unfortunately, QVR Pro does not give me an option to do anything other than email the image.

I have a dashboard that displays a new image every 5 seconds live from the camera by simply using the camera snapshot URL. This works great.

I want the ability to store and subsequently display the last motion image in a dashboard image tile. I looked at your code and I don't know enough about it to say how it works or what it is doing.

My web app might fit the bill for your needs. Let me explain with a little more detail.

In your motion piston, you would send a post request to the web app (info on github) with the direct image url for your camera (the same one you are refreshing on your dashboard currently) and the camera name to ID this camera. The web app will then grab a configurable number of images from your camera and save them on the webserver. The most recent image per camera will always be available at the same url, and will only be overwritten the next time there is a motion trigger.

so on your dashboard (or wherever) you could point to the image:
[webserver]/CameraMotionCapture/images/[myCameraName]/mostRecent.jpg
and it will always show you the most recent image captured from the last motion event.

you can also view the webapp directly ([webserver]/CameraMotionCapture/) and see all previous saved motion events if you need to... but if you have the QVR setup to record your cameras then you wont need to look at this.

Dems fighting words :smile:

Anyway, if you are happy to use node red (and a LINUX :grinning: machine like a raspberry pi) you can use a http request node (thanks to @jchurch) for this) to pull an image from your camera and store on the pi.