Home.Control – Proof of concept

I’ve been thinking about this little project for a while and finally had some hours last week to put a proof of concept together. I hereby present Home.Control:

It’s a sort of status and control touch screen you mount on your wall (in-wall mount is probably coolest, more on that later). I’m going to mount the screen in my hallway so that when I’m about to leave from the house I can know what time it is, what the weather is like outside, my agenda for the day, switch off all the lights (and turn everything back on when I return) and check if my g/f has uploaded any new images to our Picasa Web Albums account.


Current features

  • The current time and date
  • Weather conditions
  • Calendar agenda
  • Weather forecast
  • Full calendar view
  • Lights/unit control (switch lights/appliances on/off using TellStick)
  • Latest images uploaded to Picasa Web Albums
  • Anything else I would like to display, e.g. my TODO list, access to Evernote etc


Some screenshots:

Home view (when the screen is idle it turns back to this view – current time, date, weather and calendar agenda)
Home.Control screenshot

Calendar (embedded, interactive Google Calendar)
Home.Control screenshot

Weather forecast (always updated, source: yr.no)
Home.Control screenshot

Lights/appliances control (using TellStick)
Home.Control screenshot

Photos (latest x photos from Picasa Web Albums)
Home.Control screenshot

 

Technical details

Mac Mini (web server, hosting the Home.Control web app), iPhone 2g (client + touch screen), Apache, php, Google data API, TellStick device (www.telldus.se), jQuery. All info Home.Control displays is updated regularly using AJAX. The TellStick device is plugged into the Mac Mini.

31th of March 2011: Proof of concept code available!


Next steps

Bash / linux terminal script to check if new / unread email in gmail

Using a TellStick I wanted to switch on a light whenever I had unread e-mail on my Gmail account. So I created this simple bash script and made it run regularly using cron:

#!/bin/bash
RET=`curl -u user@gmail.com:yourpwd –silent “https://mail.google.com/mail/feed/atom” | perl -ne ‘print “1″ if /<(fullcount)>[^0]<\/\1>/;’`
if [ "$RET" = "1" ] ; then
tdtool –on 6
else
tdtool –off 6
fi

Run crontab -e in a terminal and add this line to make the script run every 2 minutes:

*/2 * * * * ~/.scripts/checkEmail.sh &> /dev/null

Checking if a screen session is already running, keeping it alive

I’m somewhat new to screen and bash-scripting and was looking for how to keep one of my screen sessions alive even after a system reboot. I tried searching on Google, but had a hard time finding exactly what I wanted. This is what I ended up with using cron:

Made a check script:

#!/bin/bash
foo=`screen -ls | grep -c autostart.screen`
if [ "$foo" -eq "0" ]; then
/usr/bin/screen -dmS autostart.screen /usr/bin/irssi -c freenode
fi

I named it checkIrssi.sh and made it executable with:

chmod 755 checkIrssi.sh

Then I put up a cron using “crontab -e” to run the script every hour:

* */1 * * * ~/path/to/checkIrssi.sh

And badabing!

Should you defragment your Windows iPod?

I asked myself that question today and after some Googling, I concluded:

Most people agree that the extra stress and potential failure a defragmentation inflicts on your iPod’s hard drive, is more harmful than the extra work your drive will have to do when playing back fragmented songs. Now, I’m a bit of a control freak and all though I’m in no actual control of how things are stored on the iPod, I tend to do a complete restore about every year, to clean up the iPod’s database and transfer my entire music collection in a contiguous manner to the iPod’s drive. Doing so will hopefully keep my iPod safe, longer lasting (battery wise) and fragmentation free.