Kindle Weather
This project is fully based on the project shared by Matthew Petroff: http://mpetroff.net/2012/09/kindle-weather-display/
Without his kind share of this great work, my kindle 3 might still sleep in the dust.
The changes I made:
-
Use
crontab
instead ofkite
or stoppowerd
by changing thesuspend_levels
. -
Reorganized the
weather_script.py
by spliting weather API out. -
Change
weather-script-preprocess.svg
to fit the weather API. -
Warn user when low battery(less than 10%)
-
I tried to change
weather-script-preprocess.svg
to use<image>
tag for external image which allow me to easily change the icon, but I failed to at the rsvg-convert point. So still in embedded way.
- The code is in MIT license.
- The
weather_script.py
file is based on the work of Matthew Petroff 2012, MIT license. - The
weather-script-preprocess.svg
and its embedded icon are under CC0 Public Domain Dedication license by Matthew Petroff also. I(Gris Ge) did small change to fit the weather.com API.
- Kindle 3 wireless (Only tested on this one).
- The API key from weather.com
- Kindle Jailbreak and USB network.
- A kindle WIFI accessible Linux server with
python2 pngcrush librsvg2-tools
.
- The above wiki pages works on me. The tips would be disable wifi at the initial login, then change root password, change ssh config to allow wifi login, set as auto start, reboot.
Skip this if you have USB cable always connected to your kindle.
- Execute
mntroot rw
- Execute
sed -i -e 's/1216/1152/' /etc/kdb.src/luigi/system/daemon/powerd/suspend_levels
- The
1152
here means the 7th bit(start from 0) as 0 which allows crontab in suspend mode. This is purely based on my guess, but it works. :)
- Edit the
URL
indisplay-weather.sh
by pointing to your own http server. - Create folder
mkdir /mnt/base-us/weather
. - Make sure kindle root mount point is writeable
mntroot rw
scp display-weather.sh root@k3w:/usr/bin/
- Make sure
display-weather.sh
is executable viachmod +x
on kindle.
-
Execute
mntroot rw
. -
Add this line into
/etc/crontab/root
*/60 6-22 * * * /usr/bin/display-weather.sh ```
- This means weather report will be refreshed hourly during 6AM to 10PM.
sudo yum install httpd pngcrush librsvg2-tools python2 -y
sudo systemctl enable httpd
sudo systemctl start httpd
sudo mkdir /var/www/html/weather
sudo chmod 777 /var/www/html/weather/
or usechown
.
- Add this line to
crontab -e
to refresh weather every 29 minutes during 6AM to 10PM:
*/29 6-22 * * * <PATH>/weather_script.py <API_KEY> <LAT> <LON>
- Change
<PATH>
as the folder of source code. - Change
<API_KEY>
as the weather.com API key strin. - Change
<LAT>
and<LON>
as latitude and lontitude of your city.
- Invoke
<PATH>/weather_script.py <API_KEY> <LAT> <LON>
. - Check whether you can get the weather png via:
http://<your_server_hostname>/weather/weather.png
- Include AQI(air quality index)