I have made some serious changes to the PHP web page which servers up the door controls and web cam images, so I decided to finally get FTP access to the files on the Omega. The arrival of my second Omega made this even more relevant!
Wirelessly access and edit the files on your Omega using the SFTP protocol
1. setup the Omega to accept incoming SFTP connection requests. To start, edit /etc/opkg/distfeeds.conf, and find the line below:
## src/gz reboot_packages <a href="http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?hl=en&q=http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages&source=gmail&ust=1498690346018000&usg=AFQjCNEvjkmmRXIdSU9I3y1KsHxKCo6plA">http://downloads.lede-project.<wbr />org/snapshots/packages/mipsel_<wbr />24kc/packages</a>
Remove the two # signs and the whitespace at the beginning so it looks like this:
src/gz reboot_packages <a href="http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?hl=en&q=http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages&source=gmail&ust=1498690346019000&usg=AFQjCNEvq-WxI3NgTiuHKvJ8WH-k_PSieA">http://downloads.lede-project.<wbr />org/snapshots/packages/mipsel_<wbr />24kc/packages</a>
2. Ensure your Omega is connected to your WiFi network, then connect to the command line and run the following commands:
opkg install openssh-sftp-server
3. Reboot the Onion Omega just to make sure.
4. Start your chosen FTP client (since FireFTP stopped working, I have moved back to FileZilla), and set up the IP address (either Omega-xxxx.local, 192.168.3.1 or your permanent IP address on your network, set up the user name and pssword, and the port 22.
With this set up properly, I am now able to keep backups of my php and python files on my PC, and edit them using Notepad++. The console on the Omega is a bit too flakey to use reliably, and nano on the putty terminal was starting to get tiring!
I also received another Omega2+ and a Mini Dock a couple of days ago, and I am using it to replace a Raspberry Pi I am using to run a second web cam which I use to view the driveway outside my new solid garage doors!
You would thing a simple thing like this, which is just a subset of the previous Omega setup would be relatively easy by now, but it seems that nothing is easy with an Omega. I thought I must have done something pretty serious to my last one during set up, as eventually I had to restore to factory settings using a USB stick with the latest Mega operating system on it. But no, I carefully went through my setup as detailed below, and when I set up the fixed IP address my modifying the network config file, suddenlt I lsot my wifi connection through the internet, and no amount of reverting, copying from other devices etc could get it working again. I tried many times and methods to revert to factory settings, pressing the reset button for 10 seconds, logging on and using command line stuff, connecting serially. I eventually got to the point where I was trying to reset to factory using the USB stick, but this failed repeatedly also, despite working fine on the last Omega.
Eventually something happened (sorry can’t be more specific – I don’t think I did anything, except possibly leaving it alone for a couple of hours) and it went back to factory and allowed me to set it up from scratch. As per the first time through, and the previous Omega, things like the Editor did not work properly, and still doesn’t. The only thing I am getting is an error message about corrupted Time Zone databases when I try to use the date functions in PHP.
Anyway the steps I took are:-
- Set up out of the box, connecting to my home network.
- Change passwords for root and AP wifi access. Set up timezone.
- Logon using Putty to omega-xxxx.local.
- Install Nano
- Edit the /etc/config/network file to set up a fixed IP address
- Install PHP
- Install MJPG-Streamer and set up new camera by editing /etc/config/mjpg-streamer
- Set up access for SFTP client (see top of this post) and set up Filezilla.
- Modify and upload an index.php file that allows me to view the attached web cam, and also the webcam attached to the first omega.
- set up JuiceSSH on my phone to allow me to edit files etc from my armchair!
- Finally, in order to get the camera out of the way and out of the sun, I mounted it at the top of the window rather than the bottom, which meant it was mounted upside down. Unfortunately MJPG-Streamerdoes not appear to have the option to rotate the image, so I had to modify the pages that stream this webcam to rotate the image. This page has a good write up and CSS code to do it.
The secondhand Logitech VUCR45 webcam I picked up from our local cash converters for $12 is great, it has exposure control, so it doesn’t burn out the image at midday, and in the evening the street lamp allows some visibility on the road and driveway. Much better than the old DSE camera I was using before.
Both omegas are a little slow when either or both webcams are in use, sometimes they are prettty much in sync, other times they can lag by seconds. More work is needed in this area.