Control smartphone camera with Node red installed on Android

Hey there,

I want to control my smartphone camera and taking pictures via node red.
But I have no idea how to fix this that Node red communicates with my smartphone camera.

1 Like

Hi,
What have you tried so far, and what research have you done into it/what info did you find?

I only get the information that it should works with the exec node and the information at the node red website
(https://nodered.org/docs/getting-started/android)

Okay, based on that link I'm going to assume that you are running Node-RED from Termux, on an android device, and that you'd like to use the builtin camera to take a photo through the exec node. If you follow a few of the links it mentions a termux API addon, that if installed through Termux it will expose a number of commands to the terminal. Because the exec node is used to execute commands on the local system, that's how you would use it.
https://wiki.termux.com/wiki/Termux-camera-photo
The termux-camera-photo command seems most suitable for what you are planning to do based on your first post. However, that is all the information I can find either.

I tried this command but I it still happens nothing..

Here's my flow

[
    {
        "id": "87f59d07.c87308",
        "type": "exec",
        "z": "235ac48f.9a1b34",
        "command": "",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "",
        "x": 730,
        "y": 100,
        "wires": [
            [
                "37df8933.ebd266"
            ],
            [
                "74325d34.2e9174"
            ],
            [
                "788f6223.416694"
            ]
        ]
    },
    {
        "id": "e3658cd0.4085a",
        "type": "inject",
        "z": "235ac48f.9a1b34",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 280,
        "y": 100,
        "wires": [
            [
                "165a3a77.a2f3ae"
            ]
        ]
    },
    {
        "id": "165a3a77.a2f3ae",
        "type": "function",
        "z": "235ac48f.9a1b34",
        "name": "",
        "func": "msg.payload = \"termux-camera-photo test.jpg\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 490,
        "y": 100,
        "wires": [
            [
                "87f59d07.c87308"
            ]
        ]
    },
    {
        "id": "37df8933.ebd266",
        "type": "debug",
        "z": "235ac48f.9a1b34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1030,
        "y": 80,
        "wires": []
    },
    {
        "id": "788f6223.416694",
        "type": "debug",
        "z": "235ac48f.9a1b34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1030,
        "y": 160,
        "wires": []
    },
    {
        "id": "74325d34.2e9174",
        "type": "debug",
        "z": "235ac48f.9a1b34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 1030,
        "y": 120,
        "wires": []
    }
]

And this is what I get on the output..

Picture

What command do you think the exec node is running?
Put a debug node on the output of the function node and see what it shows.

thougt this is the command for the exec: "termux-camera-photo test.jpg"

If you run that in a terminal on the phone does it work?

no doesn t work..

Well that is the problem then. Nothing to do with node-red.
How do you know it is not working?

Have you installed the Termux API addon? If not, start there. If yes, what do you see in the terminal when you type that command by hand?

I ve allready installed it..

It just shows noting and expect the next command

What do you expect to see in the terminal when you enter the command?

that a picture named test.jpg is generated

I asked what you expect to see in the terminal. I don't see anything in the description of that command that says it will confirm that it has done it. The command has not shown an error so I would expect that it thinks it has done it.

okay but if it do so where is the file?
I mean I would like to take some pictures controlled by NR..

Presumably it is in the current directory. In the terminal, run ls to see if it is there.

okay it is there, but how do i get the file then?

There is file-in node in Node-RED have you tried that?

no, cause i don t know at what file path the files are