Kindle Weather Display on the Nook

weather-script-output 2013-01-02

A couple of weeks ago, I ran across Matthew Petroff’s Kindle Weather Display but I don’t own a Kindle; I have a Nook, and because I mostly just read locally-stored documents on it, I haven’t bothered to root it. Even with those changes, I managed to find a way to adapt the original script to my environment.

I run Linux as my daily OS, so I skipped some of Matthew Petroff’s instructions for setting up a server to pull down the weather data and crunch it into a PNG file. I already had Apache installed on my laptop with the DocumentRoot pointed to /var/www. I installed pngcrush but found the version available in the repository was a couple of versions old and didn’t support the original script’s -ow argument that tells pngcrush to overwrite the file. The simple solution is to change the script to write one file with rsvg-convert and write a different file with pngcrush. These PNG files are so small (40-50Kbytes) that it’s no problem leaving an extra one lying around. At this point, I had the script working and depositing a weather graphic where I could view it locally with a web browser. The last piece was getting the graphic onto the Nook.

Since the Nook was unmodified, I couldn’t use Matthew Petroff’s method of running a script on the eReader that collects and displays the image, but an un-rooted Nook does let you set up your own screensaver images. When the Nook is plugged into my laptop, to charge or to let me add or remove files, it automounts at /media/nook. The final step was to add some code to the original script to see if the Nook is mounted, and if so, copy the fresh image to the custom screensavers directory.

With this script running once an hour, all I have to do is plug the Nook into my laptop and wait for cron to update the screensaver image with the latest forecast. While the Nook is mounted, it displays an image telling the user it’s plugged in and mounted, but once it’s detached, it will display the forecast as its “idle” image when I’m not reading books on it. If I find an inexpensive Nook or Kindle, I may stick it on the wall and fully implement the original scheme (with a Raspberry Pi gathering and formatting the forecast), but until then, I have my customisable forecast on the Nook I already have.

Here’s my cron job, based on the original, modified as described in this post:

#!/bin/sh

cd "$(dirname "$0")"

python weather-script.py
rsvg-convert --background-color=white -o weather-script-raw.png weather-script-output.svg
pngcrush -c 0 -q weather-script-raw.png weather-script-output.png
cp -f weather-script-output.png /var/www/weather-script-output.png

if [ -w /media/nook/my\ screensavers/wx/wx.png ]; then
	cp -f weather-script-output.png /media/nook/my\ screensavers/wx/wx.png
fi
Advertisements

3 responses to “Kindle Weather Display on the Nook

  1. Hi, there’s a modified script over at raspberry-pi-notes.blogspot.co.uk/2013/02/nook-e-reader-pi-display-attempt-2_3.html
    Please can one of you guys modify the get_weather_data() function?
    I would like to hold multiple locations in the file e.g. if it detects more than 2 lines, reruns the output with a different file name
    or have csv location like
    lat,long,name
    lat,long,name
    where the name is a unique label like “home” or something used to set the filemane?
    I don’t think my python skills are quite up to that yet!
    I also had in mind to modify it to run on a server, where a request with ?lat=…&?long=… generates a png (this could even be base64 to avoid writing files to the server)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s