Up until now, the
Kindle Weather Display has looked like the above with the forecast as:
Today
Tomorrow
next day (day of the week)
day after that (day of the week)
This works wonderfully until you hit about 7pm. At 7pm the forecast flips from giving you the current day's forecast to the next day's forecast. This is because the information from
NOAA being pulled is based on
UTC and not a local time zone. So to eliminate any confusion in the evening, I thought it would be nice to add the name of the day of the week for the Today and Tomorrow forecasts.
The change was pretty easy. I just needed to add a few lines to the python code. in the
Insert days of the week section I simply added a DAY_ONE and DAY_TWO variable. Here is what it looks like:
one_day = datetime.timedelta(days=1)
days_of_week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
output = output.replace('DAY_ONE',days_of_week[(day_one + 0*one_day).weekday()]).replace('DAY_TWO',days_of_week[(day_one + 1*one_day).weekday()]).replace('DAY_THREE',days_of_week[(day_one + 2*one_day).weekday()]).replace('DAY_FOUR',days_of_week[(day_one + 3*one_day).weekday()])
I'm not 100% sure that's the most efficient way to do it, but it works.
Next was to tweak the SVG file. I simply replaced Today with DAY_ONE and Tomorrow with DAY_TWO.
I also noticed the DAY_ONE day was being cut off when the actual day of the week was being inserted so I had to play around a bit with the x axis placement. I also opted for a left anchor as well which pulled the day over a little. I might play around and move it some more if it bothers me, but for now I'm happy with the placement.
Anyway, as you an see, we now have all the days of the week listed. Here's tomorrow's forecast as of 8pm tonight!
Original post with tutorial:
Kindle Weather Display
File downloads:
Kindle Weather Display Github Repository
Or if you prefer, download directly from
dropbox