We're changing our WunderBlogs. Learn more about this important update on our FAQ page.

Webcams - finding a better way, Part 2

By: GWBoone , 7:55 PM GMT on May 16, 2013

My first blog entry highlighted why I wanted to do a better job of using my home network resources while posting weather pictures to my PWS site. The driver for change was the impact of the FTP stream being sent from my IP enabled webcam to wunderground. The real impact from this FTP activity was network sensitive applications were not functioning at an optimum. In truth, the Cisco IP phone I use when working from home was dropping packets. The result was jitter commonly experience when voice and data compete for the same network resources. Time for some disclosure. My professional work is in voice communications and specifically in the IP phone arena. Jitter on a IP call from my perspective is bad enough. Jitter on a call with other communications experts on the same call and I am the source – that raises the stakes much higher. Suffice to say, along with my desire to have images included with my data for my weather hobby, there is also some professional pride to be considered.

Up to this point, I had done the simple task of re-configuring the IP web cam to FTP the image to a FTP directory on my local network. Step two is to make the file available for wunderground to collect via URL. A simple test of viewing the image via a web browser at the URL is all that is required to confirm wunderground can now pick up the image for my PWS site.

Enter problem 2, making available an image via URL that has been published to a local FTP directory. The issues being:

  • Wunderground needs a URL not an FTP address from which to collect the image

  • The FTP directory the IP camera is saving the image to does not translate to a HTTP URL

Time to do a reevaluation of the security applied to network

Disclosure number two. One purpose in adding Seagate GoFlex Home NAS to the home network is to be able to securely access files stored on the drive locally and remotely via the internet. The wiki and forum content at OpenStora.com were immeasurable in ensuring a secure internet accessible NAS on my network.

One solution to problem 2 is to move the image file from the FTP directory to a directory that is accessible from the internet. This is possible because the NAS has a small webserver included and is able to serve up webpages, images etc. Within the webserver resources, a folder /wunderground was added and a copy of the image put in the folder. Pointed my internet browser to the appropriate URL and voila the expected picture is loaded in the browser window!
A question of security remains. Does adding a new folder and serving up the image via HTTP introduce unmanaged risk to my network? A little extra research and a simple test of trying to navigate to the root of the folder resulted in a Access Forbidden error. Going one step back from the root to the URL only results in a request for user id and password for the NAS. It seems that the security designed before the change remained in effect, so I am satisfied with the result. Problem 2 solved.

Let’s recap just briefly. Web camera is sending files to local FTP. Check. The file sent to the FTP is able to be moved from the FTP directory to /wunderground. Check. The location the file is stored is able to serve up the file in an internet browser. Check. By all accounts, I now have a solution that will make the image available to wunderground. Well, kind of makes the image available to wunderground.I say kind of because, so long as I am willing to manually move the file from FTP directory to the internet accessible share every 8 minutes, then yes we have a solution. Obviously this arrangement will not work.

Enter problem 3, automatically updating /wunderground with the image from the FTP directory on a schedule. A little background to set the stage for the steps that were taken to handle this latest challenge. The Seagate GoFlex NAS is based on LINUX . I only point this out to explain the upcoming reference to create a shell file and run it via a cron job.

As the other steps in this project have been fairly simple so is the solution to problem 3. Part 1, write a simple shell script to move a copy of the file from the FTP location to the /wunderground directory. Creating the shell was as simple as logging into the Seagate Linux via my favorite Telnet/SSH client and create a simple shell to run the command to move the file from the FTP directory to /wunderground. Literally, just edit the following two lines to suite your purposes and save the file as something meaningful like movejpg.sh

mv your_local_ path_ to_ image.jpg your_local_path_to /wunderground

Next, changed the properties on the movejp.sh file to be executable by issuing the command path_to_movejpg.sh chmod +x

Part 1 done and now on to part 2, creating a cron entry to have the shell run on a schedule. By way of explanation, a cron job is a Linux command for scheduling a task to be executed sometime in the future. This is normally used to schedule a job that is executed periodically - for example, to send out a notice every morning. Or in my case, moving a file from one location to another. A handy tool for sure! Building this entry is not any more difficult than the step to create the shell to do the move of the image.
Within the cron path, I created a cron file for wunderground. The entry for the cron was to run (as an authorized user) the file movejpg.sh on 8 minute intervals. The cron entry is as simple as

*/8 * * * * authuser path_to_movejpg.sh

Save the file as wunderground and waited for 8 minutes to see what happens. 8 minutes later, success – while watching the FTP directory, the image file disappeared and reappeared in the /wunderground location. A quick test to make sure this image is able to viewed via URL. Bingo – it is there.
After this confirmation, the PWS weather camera preferences were updated with the new URL and the time interval to collect the image for my PWS site. Monitored my PWS for a few hours and once the URL was approved, the image was posted to my PWS site. Mission accomplished!!

So, as a final recap making a file available on my local device to wunderground to collect was completed by

  • FTP of the IP enabled camera’s image to the local FTP service

  • Creating an image location on the local device for wunderground to access via URL

  • Created a shell and cron job entry to move the file on a schedule

  • Updated the PWS weather camera preferences to use the new URL.
This concludes the project and how I handled the little challenges that came up along the way. I am happy to report the dual goal of supporting my PWS site with weather images from my home area and making better use of my home network have been met. I am  interested in hearing other opinions on how to achieve the same goal.

The views of the author are his/her own and do not necessarily represent the position of The Weather Company or its parent, IBM.

Reader Comments

Display: 0, 50, 100, 200 Sort: Newest First - Order Posted

Viewing: 1 - 1

Page: 1 — Blog Index

1. auburn (Mod)
9:07 PM GMT on May 20, 2013
you might consider JVjackapp with an old magicJack Dongel and a Raspberry pi...would be interesting to play with at any rate,I have used the JVjackapp and Raspberry pi for some time now.
Member Since: December 31, 1969 Posts: Comments:

Viewing: 1 - 1

Page: 1 — Blog Index

Top of Page

ALL WET (Weather, Environment & Technology)

About GWBoone

I have benefited from many other blogs, wikis, and forums. I hope there are nuggets in this blog wunderground users find helpful.

Ad Blocker Enabled

Recommended Links