From: Nigel T. <ni...@ti...> - 2002-12-29 20:08:34
|
On Sun, 2002-12-29 at 19:47, Gary Sanders wrote: > Attached is my distilled version of iButton.pl, which I use for logging > several temperature sensors around the house. Problem is, every 2 > minutes, MH pauses for about 7 seconds while the 1-wire devices are > read, and will only get worse as I add more sensors. This is on a Linux box. > > Is there a better way to do this? Ideally I'd like to use this script as > a stand-alone application, to minimize it's impact on MH's operation. > Unfortunately, I (still) don't know enough about Perl to satisfy the > scripts dependencies when I try to run it stand-alone. I do this by cycling around the sensors reading one each 2 minutes. This seems to be acceptable. > > Also, another reason for wanting to use it stand-alone is I could then > put it on a totally different linux box, and log the data to a NFS > shared directory that MH could see. > > Any suggestions? > > Gary Sanders > ---- > > # Category = iButtons > > > > $ib_outside = new iButton '100008004658f6'; # Outside temp sensor - DS1920 > $ib_attic = new iButton '10000800479bac'; # Attic temp sensor - DS18S20 > $ib_garage = new iButton '280000002cdb0a'; # Garage temp sensor - DS18B20 > $ib_d_room = new iButton '10000800479b31'; # Dining Room sensor - DS18S20 > $ib_gbr = new iButton '1000080047dc11'; # Guest Bedroom sensor - DS18S20 > $ib_mbr = new iButton '1000080047bffa'; # Master Bedroom sensor - DS18S20 > $ib_den = new iButton '1000080047b8b6'; # Den - DS18S20 > > $ib_test2 = new iButton '1000080047e354'; # test2 - DS18S20 > $ib_test3 = new iButton '1000080047bc76'; # test3 - DS18S20 > > > > > # Log temp sensor periodically ... not too often as this is slow > > if (new_minute 2) { # Log every 2 minutes > ## if (new_minute) { # Log every minute > > my $attic = ""; > my $attic = read_temp $ib_attic; > logit("/drive_b/logs/mh_log/ibutton/attic.log", "$attic", 12); # Attic temp. > > my $garage = ""; > my $garage = read_temp $ib_garage; > logit("/drive_b/logs/mh_log/ibutton/garage.log", "$garage", 12); # Garage temp. > > my $d_room = ""; > my $d_room = read_temp $ib_d_room; > logit("/drive_b/logs/mh_log/ibutton/d_room.log", "$d_room", 12); # Dining Room temp. > > my $outside = ""; > my $outside = read_temp $ib_outside; > logit("/drive_b/logs/mh_log/ibutton/outside.log", "$outside", 12); # Outside temp. > > > my $gbr = ""; > my $gbr = read_temp $ib_gbr; > logit("/drive_b/logs/mh_log/ibutton/gbr.log", "$gbr", 12); # Guest Bedroom temp. > > my $mbr = ""; > my $mbr = read_temp $ib_mbr; > logit("/drive_b/logs/mh_log/ibutton/mbr.log", "$mbr", 12); # Master bedroom temp. > > my $den = ""; > my $den = read_temp $ib_den; > logit("/drive_b/logs/mh_log/ibutton/den.log", "$den", 12); # den. > > # my $test2 = ""; > # my $test2 = read_temp $ib_test2; > # logit("/drive_b/logs/mh_log/ibutton/test2.log", "$test2", 12); # test2. > > # my $test3 = ""; > # my $test3 = read_temp $ib_test3; > # logit("/drive_b/logs/mh_log/ibutton/test3.log", "$test3", 12); # test3. > } > |