NOTE: This was originally a May, 2015 post but I just revised it today, June 26, 2016.
Back in 2012 I wrote about the SnakeOS flashed WLX-652 device ( See Original Post ). As I said then, I actually purchased it back in 2010. It’s hard to believe it but that thing has been sitting on a shelf for five years.
Well, if you have read back in my blog you’ll be aware that I have in interest in IP-Cameras. I have a couple of cameras on my property that are aimed at my mountain view. I intend to add another on my chimney so that I can look for roof damage when I am away from home. This is because, during last February I was in another state for a month and during that time 77-mph winds ripped off part of my roof and then dumped snow on top of it. That is another story for a another time and a different forum.
I share the URLs for my cameras with friends and give them the guest passwords. However, for some time I have wanted a way for them to be able to see several cameras at once, in a secure way yet without passwords. I felt that I needed a local server where the login/password process is hidden from prying eyes yet all the cameras could be simultaneously viewed in a web gallery.
It occurred to me that the venerable little WLX-652 might be sufficient for the job as my local webserver for my camera web gallery. It is! I described what I did below, but first, here is a screen capture of the web gallery that the WLX-652 serves up.
With SnakeOS you define the WWW folder in the admin section “Services->Webserver”:
Before I could work on the HTML, I needed to develop a CGI that would fetch snapshots from each IP-Camera and store them on the USB stick plugged into the WLX-652. I decided to write my CGI in shell script, which, on the WLX-652, is the fairly fully featured “dash” a derivative from Linux’s Debian distribution. A copy of the cgi script is at the bottom of the post, below the word ‘UPDATE’.
Here is what the current HTML “index.html” looks like:
To maintain the website, I keep a folder on my desktop that is a duplicate of what is on the WLX-652’s WWW folder. Mostly edit the files on my desktop and use SSH to scp files back and forth. However, SnakeOS includes vi so, using ssh it is easy to edit files right on the WLX-652’s usb drive.
By the way, SnakeOS contains a functional cron and, briefly, I considered using it to periodically download the IP-Camera images.
My admiration for the WLX-652 has grown significantly. Who would have thought – a complete local webserver fetching and hosting images of multiple IP-Cameras for the current total cost (including postage) of $33USD! The Raspberry-Pi would be what most folks would turn to for this task but it would cost significantly more (after case and PS added) and, quite frankly, is overkill for hosting a website like this.
UPDATE: A ‘like’ from reader of this blog, kittenswithselfies, caused me to read through this post once again and realize that it needed an update.
Occasionally, the WLX-652 would have its USB file system get trashed and I would have to rebuild it. I eventually tracked down the problem when I realized it only happened when after the WLX-652 had been powered down. Apparently, it was occasionally being powered down while a write was still in queue. Adding a ‘sync‘ command to the cgi script cured that problem. Next, I realized that I did not post my current, changed, the cgi script in this post. Consequentially, it is now posted below (with login/password and URL changes, for privacy):