First time caller. trouble with capture image from ipcam

Hi all. Just introduced to node-red. 25 years in IT but not anything remotely related to programming, I'm a copy/paste guy when it comes to this, at best!

I have somehow, built the following but having trouble with the proper image capture

  • raspberryPi 4 running latest node-red and mosquitto
  • wemos d1 mini attached to driveway motion sensor. when motion is sensed, the wemos sends mqtt message to node red
  • when node-red sees the mqtt payload of 'motion', it captures an image from an ipcamera.
  • timestamp and captured image are put onto nodered dashboard

so I thought I had it, but realized that every time I refresh the dashboard, I just see current image from the ipcamera. so node-red obviously isn't 'capturing' an image, its just passing the URL through to the dashboard and I see the current image from camera in realtime, or at least thats what I think is happening.

any pointers in where to look? I'm new user so can't attach the flow json file, i'll post screenshot and assume I can post the code below here. What I would really like is

  • last image is shown on UI with timestamp
  • the last X images are shown as viewable links, with timestamp for each, so I can go back and view the last few.
  • every time image is taken I get an email with that image and timestamp. i haven't tackled that yet, I want to fix the image capture first

I think I may be going about this incorrectly. Is the right way to do it to capture the image file, save it locally to the Pi, then have dynamic file listing built that shows each image 'entry'? or something similar to that.

thanks! be kind to a noob! :slight_smile:

[
    {
        "id": "66344843.4cef48",
        "type": "mqtt in",
        "z": "8cba898c.f9dff8",
        "name": "DrivewayMotionDetected",
        "topic": "driveway/motion",
        "qos": "2",
        "datatype": "auto",
        "broker": "e5102fc8.e43f8",
        "x": 150,
        "y": 280,
        "wires": [
            [
                "571b938b.bd857c",
                "b47a5cf4.d4845",
                "4a48525f.7fa57c"
            ]
        ]
    },
    {
        "id": "571b938b.bd857c",
        "type": "debug",
        "z": "8cba898c.f9dff8",
        "name": "MotionOn",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "x": 380,
        "y": 280,
        "wires": []
    },
    {
        "id": "b47a5cf4.d4845",
        "type": "function",
        "z": "8cba898c.f9dff8",
        "name": "motionTimestamp",
        "func": "msg.payload = msg.payload + \" - \" + new Date().toString();\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 410,
        "y": 220,
        "wires": [
            [
                "9edace0c.4737c"
            ]
        ]
    },
    {
        "id": "9edace0c.4737c",
        "type": "ui_text",
        "z": "8cba898c.f9dff8",
        "group": "a33c774b.319ac8",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Last Motion time",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "x": 630,
        "y": 220,
        "wires": []
    },
    {
        "id": "4a48525f.7fa57c",
        "type": "http request",
        "z": "8cba898c.f9dff8",
        "name": "camera auth",
        "method": "GET",
        "ret": "bin",
        "paytoqs": false,
        "url": "http://192.168.199.55/tmpfs/auto.jpg",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "x": 390,
        "y": 360,
        "wires": [
            [
                "77bca07a.ef5a3"
            ]
        ]
    },
    {
        "id": "9c7ec7dd.81b0c8",
        "type": "ui_template",
        "z": "8cba898c.f9dff8",
        "group": "a33c774b.319ac8",
        "name": "showPic UI",
        "order": 1,
        "width": 0,
        "height": 0,
        "format": "<p> Status:\n<img width=\"800\" height=\"600\" src=  {{msg.payload}} alt='Image not found'  />\n</p>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "templateScope": "local",
        "x": 790,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "77bca07a.ef5a3",
        "type": "function",
        "z": "8cba898c.f9dff8",
        "name": "get pic from cam",
        "func": "msg.payload = 'http://192.168.199.55/tmpfs/auto.jpg';\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 590,
        "y": 360,
        "wires": [
            [
                "9c7ec7dd.81b0c8"
            ]
        ]
    },
    {
        "id": "e5102fc8.e43f8",
        "type": "mqtt-broker",
        "z": "",
        "name": "localhost:1883",
        "broker": "localhost:1883",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "a33c774b.319ac8",
        "type": "ui_group",
        "z": "",
        "name": "Motion",
        "tab": "5dcb683f.0d5878",
        "disp": true,
        "width": 16,
        "collapse": false
    },
    {
        "id": "5dcb683f.0d5878",
        "type": "ui_tab",
        "z": "",
        "name": "Garage",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
] or paste code here

Your flow is not importable. Take a read of this thread that tells you what you need to do.and then eithor edit your post or repost your flow.

thank you, I edited it, looks a lot better now!

There is a lot discussed around this (popular?) topic in various threads, you may also try the search function as well.
Anyway, the concept is known to many around here. Without diving too deep right know, I just want to mention a few things;

  • saving a lot of snapshots to the Pi's SD card is not healthy in the long run, you should have an external mounted disk or "sacrifice" a usb stick to avoid a system crash
  • when you detect movement on your driveway, do you really want to have a notification even if it is a cat or another animal?

Myself and others are using AI to analys the image content and looking for specific objects like people. Only if a person is detected, you get a notification. As a notification service I use Telegram, fast accurate & reliable and you can attach images to the messages

You can try this:

Here's a description of something similar...

InfraRed - the project that grew and grew

In this application the image from a Raspeberry Pi camera is sent, via FTP, to a server.
A clever PHP script (Single File PHP Gallery) allows you to step through the stored images.

You might be able to apply some of these ideas/suggestions.

great thank you, will take a look this weekend

Hello Dave
I seen your thread a couple of times and had a look at the PDF writeup that you did. Inspired me a lot thanks.
One silly question:
I have manage to save the images to the static folder and can display them in the browser (in my case "http://192.168.8.30:1880/slideshow/flatdvr2.jpg"). I copied the index.php file into the same folder where the images is located (http://192.168.8.30:1880/slideshow/index.php). But , now for the silly/stupid question , how do "activate" the php file. If I direct the browser to the index.php file it ask's me to save the file.

If you mean the 'static' folder defined by the Node-RED 'settings.js' config file - I've not tried that out.
Have you got PHP running on your Pi ??

In my project I FTP the images to a remote server that is running PHP. I've also got FTP and PHP running on one of my Raspberry Pi(es) and can FTP the images there as well (but not in the 'static' folder).

When I have some spare time I'll try using the 'static' folder and let you know the outcome.

Glad you enjoyed reading the tutorial.