Not from Node-Red camera node.
Trying to rebuild using 32bit now.
I have rebuilt PI from scratch.
Loaded the following PI OS:
After that changed to fix IP, updated, run raspi-config and did the following adjustments:
On interface options I activated the camera.
On advanced options I expanded the file system
And updated the tool.
On Node-Red: (Running on Raspberry Pi : Node-RED)
-sudo apt install build-essential git curl
-bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Installed the camera support software: (node-red-contrib-camerapi (node) - Node-RED)
-sudo apt-get update
-sudo apt-get install python-picamera python3-picamera
- npm install node-red-contrib-camerapi
and installed node-red-contrib-camerapi from Node-Red Manage Pallete.
Test:
Note: TakePhotoNode with default parameters.
Result: Precisely the same!
Do you have a directory called Pictures? ls -d ~/Pictures
If not, create one. mkdir ~/Pictures
Then try taking a photo via the camerapi node again.
I installed the node-red-contrib-camerapi node for testing and followed the same steps that @pcborges indicated in a previous post. It did not work and the following error message appeared in syslog:
Oct 2 00:46:03 pi Node-RED[628]: CameraPi (log): Generate - /home/pi/Pictures/pic_33af943e-d458-45d0-9b5a-d7c24805309c.jpg
Oct 2 00:46:04 pi Node-RED[628]: CameraPi (err): Error: Command failed: python /home/pi/.node-red/node_modules/node-red-contrib-camerapi/lib/python/get_photo.py pic_33af943e-d458-45d0-9b5a-d7c24805309c.jpg /home/pi/Pictures/ jpeg 800 600 0 0 0 50 0 0 none auto 0 1.0 80 0 auto
Oct 2 00:46:04 pi Node-RED[628]: Traceback (most recent call last):
Oct 2 00:46:04 pi Node-RED[628]: File "/home/pi/.node-red/node_modules/node-red-contrib-camerapi/lib/python/get_photo.py", line 52, in
Oct 2 00:46:04 pi Node-RED[628]: picfile = open(filefqn, "wb")
Oct 2 00:46:04 pi Node-RED[628]: IOError: [Errno 2] No such file or directory: '/home/pi/Pictures/pic_33af943e-d458-45d0-9b5a-d7c24805309c.jpg'
Checking the file system I did not find a Pictures directory, so I created it like @jbudd sugested.
I ran the flow to see that it is working.
Apparently the node author forgot to mention in the doc the need to create the Pictures directory.
If I remember correctly, during the years there has always been a Picture folder there in /home/pi by default. I have them in all my RPi's and I have never created them myself
I think that may only be true on the desktop versions of the OS. My Pis, which are all the Lite (server) versions, do not have the ~/Pictures folder.
@pcborges I built a flow a couple weeks ago to take photos for a timelapse. It uses node-red-contib-camerapi
on a Pi Zero W running
Buster,
node-red v3.0.2,
node.js v14.20.0
node-red-contib-camerapi v0.0.39
pi@camera-1:~ $ cat /proc/device-tree/model
Raspberry Pi Zero W Rev 1.1pi@camera-1:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Here is the flow:
[{"id":"5685316f627e140b","type":"camerapi-takephoto","z":"8958e63f41e92ad1","filemode":"1","filename":"","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"2","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"","x":680,"y":200,"wires":[["7011601517f3fb6f","8421fac5b3818f71"]]},{"id":"f54056c633dfa3f5","type":"inject","z":"8958e63f41e92ad1","d":true,"name":"","props":[{"p":"payload"}],"repeat":"","crontab":"*/1 5-7 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":200,"wires":[["dc1ce270fc4d1918"]]},{"id":"7011601517f3fb6f","type":"debug","z":"8958e63f41e92ad1","name":"debug 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":860,"y":200,"wires":[]},{"id":"3ede666cc25a7570","type":"catch","z":"8958e63f41e92ad1","name":"","scope":null,"uncaught":false,"x":700,"y":80,"wires":[["deb85a976cfe0ec8"]]},{"id":"deb85a976cfe0ec8","type":"debug","z":"8958e63f41e92ad1","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":920,"y":80,"wires":[]},{"id":"0bccd66021888cb3","type":"inject","z":"8958e63f41e92ad1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":".02","topic":"","payload":"","payloadType":"date","x":140,"y":80,"wires":[["dc1ce270fc4d1918","d41f0bf8e7579189"]]},{"id":"dc1ce270fc4d1918","type":"counter","z":"8958e63f41e92ad1","name":"","init":"0","step":"1","lower":"","upper":"","mode":"increment","outputs":"1","x":300,"y":200,"wires":[["eafeebcd091844df"]]},{"id":"eafeebcd091844df","type":"function","z":"8958e63f41e92ad1","name":"build file name","func":"let padded = (msg.count).toString().padStart(5, '0')\nmsg.filename = 'image'+ padded+\".jpg\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":200,"wires":[["5685316f627e140b"]]}]
Ah OK, that explains it, I have never used anything else than the full versions
I did not have /home/pi/Pictures.
From /home/pi: mkdir Pictures
Run test again: from Node-Red debug window the view is the same, no data.
As you can see this time the image file was created (although not reported on the debug screen) but it is empty.
Hi, run your flow, somehow for me no change.
Rebuilt the system several times, last as described above.
Will check that, may be there is something there.
Thanks
With your rebuilt system are you able to take a picture using the command line (without sudo)?
I got the hint about the Pictures directory from the node's GitHub issues, but there's nothing there about empty files with default node settings.
The camerapi node hasn't been updated for more than 2 years. If it's true that camerapi doesn't work with the mainstream RPiOS (ie 64 bit), I'd be inclined to give up on it and use the exec node.
You could write a shell script (python is also available if you prefer snakes to snails) wrapper for raspistill to get the right output filename, report success etc
Hi all, I just checked syslog and found:
Oct 2 07:12:51 picamera Node-RED[270]: "Camera is not enabled. Try running 'sudo raspi-config' "
I have been doing this all along but seems I failed to do it on this last rebuild.
Once I went back to raspi-config and enabled the camera it works perfectly.
The real problem I believe was the lack of Picture directory.
Thank you all for your kind and competent support, learned a number of things with you guys.
A couple things I noticed
-
It looks like when you did the
npm install node-red-contrib-camerapi
you had not changed to the.node-red
directory. If you want to manually install a node, you need to first do acd .node_red
then run the npm command. You should go to your home directory and issue asudo rm -rf node-modules
then remove package.json and package-lock.json -
you did
sudo apt-get update
but did not do asudo apt upgrade
. I suggest you usesudo apt full-upgrade
apt update: updates the package cache (to know which package versions can be installed or upgraded)
apt upgrade: upgrades packages to the new version .
(you can use 'apt' instead of 'apt-get')
Did not know that.
Will also look into number 2.
Thanks again for your kind support.
Paulo Borges
I think that should be
sudo apt full-upgrade
Running now...
Thanks
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.