A 320x240 cheap (2,90€ by pearl.de) digital picture frame attached to a router is a very useful addition to show router's status information. The DPF display driver is already integrated into the lcd4linux project that makes it easy to use the frame. This for example is how it works for me:
Some details regarding DPF hacking can be found here (the page is in German)
Although lcd4linux is a powerful tool I'm still looking for a way to build complex dynamic menu structures to be able to control MPD from my remote, i.g to be able to navigate visually through the MPD database and select items into the playlist. And it seems like the lcd4linux is not powerful enough to do such things. I'll add some additional notes if I find a solution.
Update: my lcd4linux.conf for this layout is here
Update2: the digit's font is Impact, 48 points
Update3: I was asked to add some info about weather parsing
Well, first of all I have a script that is called when WAN interface goes up:
root@Buffalo:~# cat /mnt/sd/bin/onwanup.sh #!/bin/sh WANIFACE=3g-wan ifconfig "$WANIFACE" &>/dev/null || exit 1 WETTERFILE=/tmp/wetterParsed [ "$(date +%F%H)" != "$(date -r $WETTERFILE +%F%H 2>&1)" ] && { /mnt/sd/bin/getWeather.sh > "${WETTERFILE}.tmp" && \ mv "${WETTERFILE}.tmp" $WETTERFILE } /mnt/sd/bin/checkMail.sh >/tmp/tmpMail && mv /tmp/tmpMail /tmp/newMail
This script is also called each 10 minutes by a cron job. There's no need to check weather conditions each 10 minutes because it's updated only once per hour on the site. This is why getWeather.sh is inside of a conditional clause. As far as redirection (">") in bash means that the target file is locked until command is finished I have to use mv command. Otherwise syslog is filled by lcd4linux warnings that file does not exist if it tries to access it in the same time.
The weather parsing script looks like this:
root@Buffalo:~# cat /mnt/sd/bin/getWeather.sh #!/bin/sh CITYID=242242 # My City WOEID TUNITS=c # c for cilsius, f for fahrenheit DATAFILE=/tmp/tmpWeather windDirection () { awk -v deg=$1 'BEGIN { exit int((deg+11.25)/22.5)}' case $? in 0|16) echo "N" ;; 1) echo "NNE" ;; 2) echo "NE" ;; 3) echo "ENE" ;; 4) echo "E" ;; 5) echo "ESE" ;; 6) echo "SE" ;; 7) echo "SSE" ;; 8) echo "S" ;; 9) echo "SSW" ;; 10) echo "SW" ;; 11) echo "WSW" ;; 12) echo "W" ;; 13) echo "WNW" ;; 14) echo "NW" ;; 15) echo "NNW" ;; esac } parseWeather () { if [ -s "$DATAFILE" ]; then local TEMPER=`sed -nr 's/.*yweather:condition.*temp="([^"]*?).*/\1/p' $DATAFILE` local WCODE=`sed -nr 's/.*yweather:condition.*code="([^"]*?).*/\1/p' $DATAFILE` local HUMID=`sed -nr 's/.*yweather:atmosphere.*humidity="([^"]*?).*/\1/p' $DATAFILE` local PRESS=`sed -nr 's/.*yweather:atmosphere.*pressure="([^"]*?).*/\1/p' $DATAFILE | awk '{ printf("%.0f", 0.75*$0) }'` local PRESRISE=`sed -nr 's/.*yweather:atmosphere.*rising="([^"]*?).*/\1/p' $DATAFILE` local WINDDIR=`sed -nr 's/.*yweather:wind.*direction="([^"]*?).*/\1/p' $DATAFILE` local WINDSPD=`sed -nr 's/.*yweather:wind.*speed="([^"]*?).*/\1/p' $DATAFILE | awk '{ printf("%.0f",$0) }'` local FORCAST=`sed -nr 's/.*yweather:forecast.*high="([^"]*).*code="([^"]*).*/\1\n\2/p' $DATAFILE` case $PRESRISE in 0) PRESRISE='-';; 1) PRESRISE='R';; 2) PRESRISE='F';; esac echo -e "$TEMPER\n$(windDirection $WINDDIR)\n$WINDDIR\n$WINDSPD" echo -e "$HUMID\n$PRESS\n$PRESRISE\n$WCODE\n$FORCAST" fi } [ -n "$1" ] && CITYID=$1 DATAFILE="${DATAFILE}${CITYID}" URL="http://weather.yahooapis.com/forecastrss?w=$CITYID&u=$TUNITS" wget -q -O "$DATAFILE" "$URL" && parseWeather
It's not very efficient but it doesn't have to be as far as I start it only once per hour.
9 comments:
Very nice layout of the screen. Can you please explain how you created the large font used for the clock? And how you included the weather icons?
Ed
these are images actually. If you know the bounding box then you can use any graphics editor to type text into it until the font you use suits the best. Weather icons are also images. I'm using yahoo weather service to get weather information and they encode weather condition as a number from 1 to 47. I've downloaded a long image strip with icons from their site and split them into separate images using ImageMagic. The trick was that icons in that image strip are placed according to the weather numbering scheme they use. So now for example if I get weather condition 24 I simply display an icon '24.png'
Ah, ok. Thank you for explaining. I like it: food for thought. Good for a few hours of puzzling with lcd4linux.conf and other stuff.
Hi,
nice to see. I have downloaded the images from yahoo. But they are not so nice as the images i see in your screenshot (http://l.yimg.com/a/i/us/we/52/28.gif). Can you make the images (weather and font) public please? Can you provide a link to them.
Thanx
Digits are here http://goo.gl/HK0wc
I'm afraid I'm not allowed to distribute yahoo weather icons but you may try the following link
http://l.yimg.com/a/i/us/my/mw/modules/type_weather/0ds.png
Just iterate from 0 to 48 in the image name.
Thanx
I am also experimenting with lcd4linux (with my Raspberry Pi). Thank you for sharing your configuration. Would you mind sharing how you scrape weather conditions into your wetterParsed file? I'm currently just extracting the (text) forcast for my location from http://www.donnerwetter.de/ and having them in a better parsable format like you would be nice.
I've updated the page with my weather parsing script
Thanks, the script works like a charm.
Post a Comment