Expanding the Home Dashboard

In the previous post, I outlined the Home Dashboard touchscreen for controlling lights, temperature/humidity, displaying Amazon Echo information, displaying who’s home (via bluetooth sniffing), and displaying what was being watched on DirecTv.  As this dashboard is intended to be a sudo remote control for my home, I thought it made sense to be able to actually control the TV with it.
Screenshot 2016-09-01 at 10.18.31 PMScreenshot 2016-09-01 at 10.18.09 PM
After a bit of tweaking and some UI work, the end result is a super-quick (HTTP response is ~30 milliseconds which feels nearly as quick as the standard DirecTv remote) interaction between device and DirecTv receiver.
From my home dashboard/touchscreen controller, I can select the title that’s currently playing to launch the remove control (pictured above).  You’ll notice that the touchscreen controller can do everything the standard remote can do, including guide browsing, DVR browsing, etc.

Home Dashboard using a Raspberry Pi

After creating a desktop home automation dashboard and, later, a live stream “digital picture frame”, I got the idea to combine the two into an always-on control panel that condenses everything I care about into a single kiosk which can sit on my end table or nightstand.

What it does

It’s essentially a condensed UI of the desktop version linked above which uses the same databases and processes.

  • Current indoor temperature and humidity (via DHT11 sensor)
  • If my Amazon Echo is playing music, it’ll display the artist, song, and album
  • If I’m watching TV, it’ll show the title, channel, and image/movie poster
  • Display unique icons for each person in the house (by sniffing for their phone’s bluetooth signal)
  • It’ll show the status of my lights (on/off) and update if that status changes (using the Wink API)
  • Through touch screen, allow me to control my lights in near real-time.

Materials Used

How it works

Much of this (temperature, humidty, DirecTv and Wink control) is covered in “The Foundation” post.  Specific to collecting information from the Amazon Echo, I use IfTTT and the Maker channel.  Each time my Echo plays a song, I POST to a script similar to the one below which stores the song in a MySQL database.  I can then query that, determine if the song is still playing, and publish it to the UI.

<?php
$conn = mysqli_connect(<credentials>);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$song=$_REQUEST['song'];
$artist=$_REQUEST['artist'];
$album=$_REQUEST['album'];
$timestamp=$_REQUEST['timestamp'];
$sql = "INSERT INTO echo_history (artist, song, album, timestamp)
VALUES ('$artist', '$song', '$album', '$timestamp')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>

My Maker recipe looks something like this: IF then to URL

recordmusic.php?artist= {{ArtistName}}&song={{SongName}} &album={{AlbumName}} &timestamp={{PlayDateTime}}

Method POST.
That’s about it for the controller – quite simple and is probably the most practical project I’ve done thus far.

Webcam Stream as Digital Picture Frame

I don’t have a quality window view in my office building and found myself checking the local news’ weather cams throughout the day so I thought it’d be cool to have a live outdoor view streaming to my desk.  Using a Pi 3, Pi Displaya case, and camera, I built a digital picture frame which streams a live video feed from my apartment window to my desk at work.  While going through the process, I hit a few hiccups and a ton of outdated resources online so I thought I’d share my learnings and provide documentation for anyone wishing to recreate.


The following will setup a Pi to run Chromium in Kiosk mode on startup while silencing errors and hiding your cursor.  The assumptions made before beginning are that you’re able to SSH into both of the Pis and your Pis are connected to WiFi.  The guide I followed to setup my cam stream is solid so no need to re-invent the wheel – use this guide to setup your first Pi to stream your cam image.  The obvious callout is to make sure your stream resolution matches your display’s resolution.  The steps below will be for your picture frame Pi and assume you’ve already got your stream up and running…
Step 1
Run the update/upgrade and install Chromium (as explained here).
sudo apt-get update
sudo apt-get upgrade
Step 2
Install x11 server utilities and unclutter.
sudo apt-get install x11-xserver-utils unclutter
Step 3
Since we want this to be as hands-off as possible and to silence any power-saving settings or error messages on power cycles, we’ll edit the LXDE startup to disable this stuff.
sudo nano ~/.config/lxsession/LXDE-pi/autostart
and add the following lines (not the screensaver commented out):
#@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
@sed -i ‘s/”exited_cleanly”: false/”exited_cleanly”: true/’ ~/.config/chromium/Default/Preferences
The last line we’ll add in this file will be the address we want to display.  In the example below, we’ll sinply load Google.com.  We use the incognito tag to prevent Chromium from showing an error in the event of a power cycle.
@chromium-browser –noerrdialogs –kiosk http://www.google.com –incognito
Now, exit and write.
Step 4
Let’s reboot and apply the changes to see the results
sudo reboot