I have built a motion sensor detector using this code: from the dronebotworkshop on youtube. While it works very well for me, I now want to upload the pictures to my NAS server. I googled this and found this line of code:
curl -T /home/pi/filename.jpg ftp://ftp-host-machine//yourwebsite/folder/filename.jpg --user
Now when I run the python script:
from picamera import PiCamera import time import datetime
# Create object for PIR Sensor # PIR Sensor is on GPIO-4 (Pin 7) pir = MotionSensor(4)
# Create Object for Camera camera = PiCamera()
# Function to create new Filename from date and time def getFileName(): return datetime.datetime.now().strftime("%Y-%m-%d_%H.%M.%S.h264")
while True: # Get a Filename filename = getFileName() # Wait for a motion to be detected pir.wait_for_motion # Print text to Shell print("Jellybean thief detected!") # Preview camera on screen during video camera.start_preview() # Start recording video camera.start_recording(filename) # Record for 10 seconds camera.wait_recording(10) # Stop preview and recording camera.stop_preview() camera.stop_recording() curl -T /home/pi/filename.jpg ftp://ftp-ipaddressof NAS server/mnt/folder/filename.jpg --user # Wait 25 seconds and repeat time.sleep(25)
It returns Invalid syntax at the ftp://ftp- etc
I can get as far as a login box from my Ubuntu desktop with this: ftp://server ip address/mnt/Folder/subfolder, but it fails completely on the PiZero with invalid synatx at ftp