krispin
Posts: 56
Joined: Fri Nov 25, 2016 4:47 pm
Location: North Vancouver
Contact: Website

Weather Underground - IP camera

Thu May 25, 2017 5:16 pm

Has anyone successfully set up an USB - IP camera that FTP's images to Weather underground.

Apparently it is possible but there seems to be a lack of information with regards to the Praspberry Pi

Cheers,
krispin

mohog
Posts: 75
Joined: Wed May 08, 2013 11:53 am

Re: Weather Underground - IP camera

Sat Jun 03, 2017 11:35 pm

I have been able to send photos, however I am using the standard rpi camera. But if you can get an image saved from the camera then you should be able to upload it.

I am using "mmal-motion" to capture images so I grab an image saved by that software. Make sure to save the image as the same name each time such as image.jpg.

I created a shell script to upload the images via ftp (I am using lftp). The script is named wunder.sh and is in the home directory. Filename, hostname, username, and password must be in quotes.

Code: Select all

#!/bin/bash

filename="location_of_file"
hostname="webcam.wunderground.com"
username="camerausername"
password="password"
lftp ftp://$username:[email protected]$hostname -e "put /mnt/usb/motion/image.jpg ; quit"
Make the script executable

Code: Select all

sudo chmod +x wunder.sh
Using the crontab I send an image every 15 minutes. For what ever reason I am no longer able to get a shell script to run from the crontab so I ended up making a python script to run the shell script. Likely a better solution available.

Code: Select all

sudo nano wunder.py

Code: Select all

#!/usr/bin/env python

import shutil
import os
os.system("bash -c /home/pi/wunder.sh")

Code: Select all

sudo chmod -x wunder.py
sudo crontab -e
add this line to the end of the crontab

Code: Select all

*/15 * * * * /home/pi/wunder.py

krispin
Posts: 56
Joined: Fri Nov 25, 2016 4:47 pm
Location: North Vancouver
Contact: Website

Re: Weather Underground - IP camera

Tue Jun 06, 2017 7:10 pm

SWEET! Thanks for your help.

Cheers,
krispin

krispin
Posts: 56
Joined: Fri Nov 25, 2016 4:47 pm
Location: North Vancouver
Contact: Website

Re: Weather Underground - IP camera

Fri Nov 16, 2018 5:52 pm

Time to resurrect this thread.

I am having issues again with uploading to weather underground. Actually I can't even get the the uploading part, I can't even get the Cron job to run to take the picture which I can then upload.

The previous go round I had this issue as well and ended up run the whole process using SUDO, but I know that is a BIG no no.

I have been reading a lot about absolute paths and Cron jobs, but I have yet to find the magic path that makes this whole thing work.

Any thoughts as two what I can do?
  • Raspberry Pi is a fresh install
    I have x+ chmod'ed my executeables
    I am logged in as pi
    I have tried all the methods that have been described in this thread and they work if executed on their own, but not in Cron.

Return to “Weather station”