Interactive Smart Mirror
Other Dependencies
With the UPM modules installed, we can work on writing the actual code. That does mean we need to install a few more dependencies, though.
Other Node Libraries
We need one more library for our code. Luckily, we can install it through npm:
cd ~
npm install xml2js
NTP
We will want our Edison system time to be up-to-date. To do that, we will rely on an NTP service to regularly poll an Internet-connected server for the most accurate time.
Open the package manager file with:
vi /etc/opkg/base-feeds.conf
Press 'i' to start typing, and enter the following:
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
Press 'esc', and enter ':wq' to save and exit. Update the package manager, and install the NTP client:
opkg update
opkg install ntp
Configure the NTP client:
vi /etc/ntp.conf
Find the line that says "server 127.127.1.0" and change it to (press 'i' to edit):
server pool.ntp.org
Your file should look like this:
Save and exit ('esc' and ':wq'). Next, we want to adjust our system's local time to our timezone. Since I am in Mountain Standard Time, I'm going to use MST. We do this by creating a symbolic link /etc/localtime that points to the timezone we want in /usr/share/zoneinfo/ (note that I'm using MST for my timezone).
rm /etc/localtime
ln -s /usr/share/zoneinfo/MST /etc/localtime
When we're done, reboot:
reboot
You can check your timezone by entering the command:
date
This should print out the date, time, and timezone.
Configure OpenWeatherMap
We will be using OpenWeatherMap for our weather data, as it offers good hourly forecast data. In your browser, navigate to OpenWeatherMap's sign up page. Enter your credentials to make an account. Once you have logged in, scroll down on your profile page, and copy down your API key.
Find Your Location
We also need to find our location so we can pass that to OpenWeatherMap. Open up Google Maps, and place a marker at the location where you want to get weather data (left-click on the map). A pop-up note will appear with the latitude and longitude data.
Copy down those two numbers as well. We'll need them.