I saw a post on Digg today about changing the Ready message on the screen of your HP Printers. So I took a look at it and modified it so that it will read the XML output of the Google weather service. Just change the IP address to that of your HP Printer and then set it up as a scheduled task. Then change the Google URL to your location.
http://www.google.com/ig/api?weather= 03051 &hl=en
If you ever want to know how cold it is outside, take a look at your printer.
#!/usr/bin/perl
# $Id: hpsetdisp.pl 11 2006-03-22 01:21:03Z yaakov $
# hpsetdisp.pl
# Connects to a JetDirect equipped HP printer and uses
# HP's control language to set the ready message on the
# LCD display. Takes an IP address and message on the
# command line. My favorite message is "INSERT COIN".
# Keep in mind the limitations of the display when composing
# your clever verbiage.
#
# THIS PROGRAM IS PROVIDED WITH NO WARRANTY OF ANY KIND EXPRESSED OR IMPLIED
# THE AUTHOR CANNOT BE RESPONSIBLE FOR THE EFFECTS OF THIS PROGRAM
# IF YOU ARE UNCERTAIN ABOUT THE ADVISABILITY OF USING IT, DO NOT!
#
# Yaakov (http://kovaya.com/ )
#
# Modified by Garrett Hoofman
# 10/18/2007
# http://www.visionsofafar.com
use strict;
use warnings;
use XML::DOM;
my $file = 'http://www.google.com/ig/api?weather=03051&hl=en';
my $peeraddr = "192.168.83.4";
my $rdymsg = "Ready";
my $parser = XML::DOM::Parser->new();
my $doc = $parser->parsefile($file);
foreach my $species ($doc->getElementsByTagName('current_conditions')){
$rdymsg = $species->getElementsByTagName('temp_f')->item(0)
->getAttribute('data') . " Degrees Out " . $species->getElementsByTagName('condition')->item(0)
->getAttribute('data');
print "\n";
}
chomp $peeraddr;
use IO::Socket;
my $socket = IO::Socket::INET->new(
PeerAddr => $peeraddr,
PeerPort => "9100",
Proto => "tcp",
Type => SOCK_STREAM
) or die "Could not create socket: $!";
my $data = <<EOJ
\e%-12345X\@PJL JOB
\@PJL RDYMSG DISPLAY="$rdymsg"
\@PJL EOJ
\e%-12345X
EOJ
;
print $socket $data;