It-Slav.net is proud to announce as one of the temperature providers to temperatur.nu
It-slav.net provides temperature measurement for STHLM/Huddinge area in Sweden to the very popular site temperatur.nu
The measurment is done by a 1-wire temperature probe DS18S20.
The script that collects the temperature and stores it in a file that is presented as a webpage, the webpage is polled regularly by temperatur.nu
#!/usr/bin/perl # # rrd_tempsensor.pl
#use lib qw(/usr/local/rrdtool-1.2.15/lib/perl); use RRDs; use OW;
# define location of rrdtool databases my $rrd = '/root/owfs/script/rrd_db'; # define location of images my $img = '/home/peter/public_html/temps';
# process data for each interface (add/delete as required) &ProcessSensor(0, "Temperatur_Huddinge", "op5.mynet",3001,"10.DEF05F010800");
sub ProcessSensor { # process sensor # inputs: $_[0]: sensor number (ie, 0/1/2/etc) # $_[1]: sensor description print "number:$_[0] desc:$_[1], server:$_[2] port:$_[3], id: $_[4]\n"; my $owserver = "$_[2]:$_[3]";
unless(OW::init($owserver)) { $status = $ERRORS{CRIT}; $message = "OWServer not running at $owserver\n"; exit $status; }
# get temperature from sensor my $handle = OW::get("$_[4]/temperature"); # print "handle=$handle\n"; $handle =~ s/^\s*(.*?)\s*$/$1/; ## Check if input is an integer or decimal unless (($handle =~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/) || ($handle =~ /^[+-]?\d+$/)) { print "Not an integer or a decimal\n"; return($ERRORS{CRITICAL}); }
$temp=$handle; # remove eol chars chomp($temp);
print "sensor $_[0]: $temp degrees C\n";
# check for error code from temp sensor if (int $temp eq 85) { print "failed to read value from sensor $_[0]\n"; } else { #Create webpage open WEBPAGE, ">$img/$_[1]" or die "Cannot create $img/$_[1]: $!"; print WEBPAGE "$temp\n"; } }
Links:
- http://www.temperatur.nu temperatures from alot of places in Sweden
- My info page at temperatur.nu
- Temperature graphs made by data from me
- The “webpage” that the script create
- More information about 1-wire at this blog
2 Responses to “Temperature measurment for temperatur.nu”
Leave a Reply
You must be logged in to post a comment.
February 22nd, 2010 at 9:16 am
Hi Peter, I think you have to change the position of the temp probe, allways a few degree warmer than all our thermometers in Huddinge/Stuvsta.
February 22nd, 2010 at 9:34 am
I have noticed that asweell. The temp probe is probably to close to the house. I will look into that when the snow is gone 🙂