diff --git a/fhem/CHANGED b/fhem/CHANGED index 5db9905f6..36cac8166 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -362,7 +362,7 @@ - feature: alternativ Quad-based numbers for the FS20 (Matthias, 24.11) - feature: dummy type added (contrib/99_dummy.pm) -- ==DATE== (4.3) +- 2008-07-12 (4.3) - bugfix: KS300 state was wrong after the STATE bugfix - feature: HMS100CO (by Peter) - feature: EMGZ (by Peter) @@ -410,3 +410,7 @@ - bugfix: deleting FS20 device won't result in unknown device (Daniel, 11.7) - feature: webpgm2 generates SVG's from logs: no need for gnuplot - bugfix: examples corrected to work with current syntax + +- ==DATE== (4.4) + - feature: RM100-2 battery empty warning (mare 23.07.08) + - feature: optimising the pgm2/SVG memory usage diff --git a/fhem/FHEM/12_HMS.pm b/fhem/FHEM/12_HMS.pm index d3a1f1c3a..724c9d026 100755 --- a/fhem/FHEM/12_HMS.pm +++ b/fhem/FHEM/12_HMS.pm @@ -164,7 +164,10 @@ HMS_Parse($$) @sfx = ( "", ""); $v[0] = ( hex(substr($val, 1, 1)) != "0" ) ? "on" : "off"; - $v[1] = "unknown"; # Battery-low detect is _NOT_ implemented. + $v[1] = "ok"; + my $status = hex(substr($msg, 10, 1)); + if( $status & 4 ) { $v[1] = "empty"; } + if( $status & 8 ) { $v[1] = "replaced"; } $val = "smoke_detect: $v[0]"; } elsif ($type eq "HMS100MG") { # By Peter Stark diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index c528a6763..471ef75a4 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -4,6 +4,7 @@ package main; use strict; use warnings; use IO::File; +#use Devel::Size qw(size total_size); sub seekTo($$$$); @@ -168,6 +169,11 @@ FileLog_Get($@) my $outf = shift @a; my $from = shift @a; my $to = shift @a; # Now @a contains the list of column_specs + my $internal; + if($outf eq "INT") { + $outf = "-"; + $internal = 1; + } if($inf eq "-") { $inf = $hash->{currentlogfile}; @@ -215,11 +221,12 @@ FileLog_Get($@) my %lastdate; while(my $l = <$ifh>) { last if($l gt $to); - my @fld = split("[ \r\n]+", $l); + my @fld = split("[ \r\n]+", $l); # 40% + for my $i (0..int(@a)-1) { # Process each req. field my $h = $d[$i]; my $re = $h->{re}; - next if($re && $l !~ m/$re/); + next if($re && $l !~ m/$re/); # 20% my $col = $h->{col}; my $line = ""; @@ -298,13 +305,16 @@ FileLog_Get($@) $ret .= "#$a[$i]\n"; } else { my $fh = $h->{fh}; -#Log 0, "FLg: $i: >$h->{count}, $h->{df}<"; if(!$h->{count} && $h->{df} ne "") { print $fh "$from $h->{df}\n"; } $fh->close(); } } + if($internal) { + $internal_data = \$ret; + return "OK"; + } return ($outf eq "-") ? $ret : join(" ", @fname); } diff --git a/fhem/FHEM/99_SUNRISE_EL.pm b/fhem/FHEM/99_SUNRISE_EL.pm index f207cccb3..c326ee7d0 100755 --- a/fhem/FHEM/99_SUNRISE_EL.pm +++ b/fhem/FHEM/99_SUNRISE_EL.pm @@ -19,6 +19,7 @@ sub sunrise_abs(@); sub sunset_abs(@); sub isday(); sub sunrise_coord($$$); + sub SUNRISE_Initialize($); # See perldoc DateTime::Event::Sunrise for details diff --git a/fhem/Makefile b/fhem/Makefile index 087895820..a946bb9d7 100644 --- a/fhem/Makefile +++ b/fhem/Makefile @@ -11,20 +11,22 @@ all: install: cp fhem.pl $(BINDIR) - cp -rp FHEM $(MODDIR) + cp -r FHEM $(MODDIR) perl -pi -e 's,modpath .,modpath $(MODDIR),' examples/* install-pgm2: cp fhem.pl $(BINDIR) - cp -rp FHEM $(MODDIR) - cp -rp webfrontend/pgm2/* $(MODDIR) + cp -r FHEM $(MODDIR) + cp -r webfrontend/pgm2/* $(MODDIR) perl -pi -e 's,modpath .,modpath $(MODDIR),' examples/* dist: @echo Version is $(VERS), Date is $(DATE) mkdir .f - cp -rp * .f + cp -r CHANGED FHEM HISTORY Makefile README.CVS em1010pc\ + TODO contrib docs examples fhem.pl test webfrontend .f find .f -name \*.orig -print | xargs rm -f + find .f -name .#\* -print | xargs rm -f find .f -type f -print |\ xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g' mv .f fhem-$(VERS) diff --git a/fhem/docs/faq.html b/fhem/docs/faq.html index 94470b16a..703983926 100644 --- a/fhem/docs/faq.html +++ b/fhem/docs/faq.html @@ -46,6 +46,9 @@ me?

12. I'd like to switch on the ventilator if the FHT tells me its too hot. How to tell fhem to do that?

+13. I'd like to see directly in the Web frontend if a window is open. How to do that?

+ +



@@ -273,5 +276,19 @@ by fhem.pl? + +13. I'd like to see directly in the Web frontend if a window is open. +How to do that? (by fwolff) + + diff --git a/fhem/docs/fhem.html b/fhem/docs/fhem.html index 9c15c1a5d..547f15f91 100644 --- a/fhem/docs/fhem.html +++ b/fhem/docs/fhem.html @@ -42,7 +42,7 @@ Currently implemented features:
encryption.
  • reading WS300 data, and up to 9 attached devices
  • -
  • reading EM1000WZ/EM1000EM data via an attached EM1010PC
  • +
  • reading EM1000WZ/EM1000EM/EM1000GZ data via an attached EM1010PC
  • reading attached SCIVT devices
  • reading attached M232 devices
  • reading attached WS2000/WS25000 devices, also via raw network converters(xport)
  • diff --git a/fhem/examples/06_at b/fhem/examples/06_at index 0f7b9e445..c03a8837f 100644 --- a/fhem/examples/06_at +++ b/fhem/examples/06_at @@ -34,6 +34,11 @@ define a11 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) } # Switch lamp1 and lamp2 on from 7:00 till 10 minutes after sunrise define a12 at *07:00 set lamp1,lamp2 on-till {sunrise_abs(+600)} +################################## +# Switch lamp1 on at sunrise, but not before 07:00 +# Note: you have to put 99_Utils.pm in the FHEM modules directory +define a13 at +*{max(abstime2rel("07:00"),sunrise_rel())} set lamp1 on + ################################## # Blink 3 times if the piri sends a command define n1 notify piri:on.* define a13 at +*{3}00:00:02 set lamp on-for-timer 1 diff --git a/fhem/fhem.pl b/fhem/fhem.pl index f224b4f82..227d1cf1c 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -125,6 +125,7 @@ use vars qw(%value); # Current values, see commandref.html use vars qw(%oldvalue); # Old values, see commandref.html use vars qw($nextat); # used by the at module use vars qw($init_done); # +use vars qw($internal_data); # my $server; # Server socket my $currlogfile; # logfile, without wildcards @@ -140,7 +141,7 @@ my %intAt; # Internal at timer hash. my $intAtCnt=0; my $reread_active = 0; my $AttrList = "room comment"; -my $cvsid = '$Id: fhem.pl,v 1.46 2008-07-11 07:26:19 rudolfkoenig Exp $'; +my $cvsid = '$Id: fhem.pl,v 1.47 2008-07-24 07:39:15 rudolfkoenig Exp $'; $init_done = 0; @@ -390,12 +391,12 @@ Log($$) my $nfile = ResolveDateWildcards($attr{global}{logfile}, @t); OpenLogfile($nfile) if($currlogfile && $currlogfile ne $nfile); - my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d", - $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0]); +# my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d", +# $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0]); -# my ($seconds, $microseconds) = gettimeofday(); -# my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d.%03d", -# $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], $microseconds/1000); + my ($seconds, $microseconds) = gettimeofday(); + my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d.%03d", + $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], $microseconds/1000); if($logopened) { print LOG "$tim $loglevel: $text\n"; diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm index 3adaf68a0..3960eb43a 100755 --- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm +++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm @@ -5,6 +5,7 @@ use strict; use warnings; use IO::Socket; +#use Devel::Size qw(size total_size); ################### @@ -998,8 +999,8 @@ FHEMWEB_showLog($) $f = 0 if(!$f); # From the beginning of time... $t = 9 if(!$t); # till the end - my $ret = fC("get $d $file - $f $t " . join(" ", @filelog)); - SVG_render($file, $__plotsize, $f, $t, \@data, \$ret, $plot); + my $ret = fC("get $d $file INT $f $t " . join(" ", @filelog)); + SVG_render($file, $__plotsize, $f, $t, \@data, $internal_data, $plot); $__RETTYPE = "image/svg+xml"; } diff --git a/fhem/webfrontend/pgm2/98_SVG.pm b/fhem/webfrontend/pgm2/98_SVG.pm index 2ec32fe28..079ec942b 100755 --- a/fhem/webfrontend/pgm2/98_SVG.pm +++ b/fhem/webfrontend/pgm2/98_SVG.pm @@ -4,6 +4,9 @@ package main; use strict; use warnings; use POSIX; +#use Devel::Size qw(size total_size); + + sub SVG_render($$$$$$$); sub time_to_sec($); @@ -36,7 +39,7 @@ SVG_render($$$$$$$) if($a[0] && $a[0] eq "set") { $conf{$a[1]} = $a[2]; } } @{$confp}; # Html Header - pO "\n"; + pO "\n"; pO "\n"; pO "\n"; pO "\n"; @@ -91,8 +94,18 @@ SVG_render($$$$$$$) my (%hmin, %hmax, @hdx, @hdy); my ($dxp, $dyp) = (\(), \()); - my ($d, $v); - foreach my $l (split("\n", $$dp)) { + my ($d, $v, $ld, $lv) = ("","","",""); + + my ($dpl,$dpoff,$l) = (length($$dp), 0, ""); + while($dpoff < $dpl) { # using split instead is memory hog + my $ndpoff = index($$dp, "\n", $dpoff); + if($ndpoff == -1) { + $l = substr($$dp, $dpoff); + } else { + $l = substr($$dp, $dpoff, $ndpoff-$dpoff); + } + $dpoff = $ndpoff+1; + if($l =~ m/^#/) { my $a = $axes[$idx]; $hmin{$a} = $min if(!defined($hmin{$a}) || $hmin{$a} > $min); @@ -104,15 +117,20 @@ SVG_render($$$$$$$) } else { ($d, $v) = split(" ", $l); - push @{$dxp}, ($tmul ? int((time_to_sec($d)-$fromsec)*$tmul) : $d); - push @{$dyp}, $v; - $min = $v if($min > $v); - $max = $v if($max < $v); + $d = ($tmul ? int((time_to_sec($d)-$fromsec)*$tmul) : $d); + if($ld ne $d || $lv ne $v) { # Saves a lot on year zoomlevel + $ld = $d; $lv = $v; + push @{$dxp}, $d; + push @{$dyp}, $v; + $min = $v if($min > $v); + $max = $v if($max < $v); + } } + last if($ndpoff == -1); } $dxp = $hdx[0]; - if(int(@{$dxp}) < 2 && !$tosec) { # not enough data and no range... + if($dxp && int(@{$dxp}) < 2 && !$tosec) { # not enough data and no range... pO "\n"; return; } @@ -261,11 +279,16 @@ SVG_render($$$$$$$) my $hmul = $h/($hmax{$a}-$min); my $ret = ""; my ($dxp, $dyp) = ($hdx[$idx], $hdy[$idx]); + next if(!defined($dxp)); + my ($lx, $ly) = (-1,-1); if($type[$idx] eq "points" ) { foreach my $i (0..int(@{$dxp})-1) { - my ($x1, $y1) = ($x+$dxp->[$i], $y+$h-($dyp->[$i]-$min)*$hmul); + my ($x1, $y1) = (int($x+$dxp->[$i]), + int($y+$h-($dyp->[$i]-$min)*$hmul)); + next if($x1 == $lx && $y1 == $ly); + $ly = $x1; $ly = $y1; $ret = sprintf(" %d,%d %d,%d %d,%d %d,%d %d,%d", $x1-3,$y1, $x1,$y1-3, $x1+3,$y1, $x1,$y1+3, $x1-3,$y1); pO "\n"; @@ -281,6 +304,8 @@ SVG_render($$$$$$$) foreach my $i (1..int(@{$dxp})-1) { my ($x1, $y1) = ($x+$dxp->[$i-1], $y+$h-($dyp->[$i-1]-$min)*$hmul); my ($x2, $y2) = ($x+$dxp->[$i], $y+$h-($dyp->[$i] -$min)*$hmul); + next if(int($x2) == $lx && int($y1) == $ly); + $lx = int($x2); $ly = int($y2); $ret .= sprintf(" %d,%d %d,%d %d,%d", $x1,$y1, $x2,$y1, $x2,$y2); } } @@ -295,6 +320,8 @@ SVG_render($$$$$$$) foreach my $i (1..int(@{$dxp})-1) { my ($x1, $y1) = ($x+$dxp->[$i-1], $y+$h-($dyp->[$i-1]-$min)*$hmul); my ($x2, $y2) = ($x+$dxp->[$i], $y+$h-($dyp->[$i] -$min)*$hmul); + next if(int($x2) == $lx && int($y1) == $ly); + $lx = int($x2); $ly = int($y2); $ret .= sprintf(" %d,%d %d,%d %d,%d %d,%d", $x1,$y1, ($x1+$x2)/2,$y1, ($x1+$x2)/2,$y2, $x2,$y2); } @@ -303,14 +330,16 @@ SVG_render($$$$$$$) } else { # lines and everything else foreach my $i (0..int(@{$dxp})-1) { - $ret .= sprintf(" %d,%d", $x + $dxp->[$i], - $y + $h-($dyp->[$i]-$min)*$hmul); + my ($x1, $y1) = (int($x+$dxp->[$i]), + int($y+$h-($dyp->[$i]-$min)*$hmul)); + next if($x1 == $lx && $y1 == $ly); + $lx = $x1; $ly = $y1; + $ret .= sprintf(" %d,%d", $x1, $y1); } pO "\n"; } } - pO "\n"; } diff --git a/fhem/webfrontend/pgm2/fht.gplot b/fhem/webfrontend/pgm2/fht.gplot index b8a9adb04..ea0ac38dd 100644 --- a/fhem/webfrontend/pgm2/fht.gplot +++ b/fhem/webfrontend/pgm2/fht.gplot @@ -14,7 +14,7 @@ set y2tics set title '' set grid xtics y2tics -set y2label "Temperature in C°" +set y2label "Temperature in C" set ylabel "Actuator (%)" #FileLog 4:measured:0: diff --git a/fhem/webfrontend/pgm2/ks300_1.gplot b/fhem/webfrontend/pgm2/ks300_1.gplot index c12570937..5a6898d39 100644 --- a/fhem/webfrontend/pgm2/ks300_1.gplot +++ b/fhem/webfrontend/pgm2/ks300_1.gplot @@ -13,7 +13,7 @@ set y2tics set title '' set grid -set y2label "Temperature in C°" +set y2label "Temperature in C" set format y "%0.1f" set ylabel "Rain (l/m2)" set yrange [0:] diff --git a/fhem/webfrontend/pgm2/ks300_3.gplot b/fhem/webfrontend/pgm2/ks300_3.gplot index 4f1e6c7ca..ccc120623 100644 --- a/fhem/webfrontend/pgm2/ks300_3.gplot +++ b/fhem/webfrontend/pgm2/ks300_3.gplot @@ -13,7 +13,7 @@ set y2tics set title '' set grid -set ylabel "Temperature in C°" +set ylabel "Temperature in C" set y2label "Rain (l/m2)" #FileLog 5:avg_day:0: diff --git a/fhem/webfrontend/pgm2/style.css b/fhem/webfrontend/pgm2/style.css index 05a9526df..ab06c3ef1 100644 --- a/fhem/webfrontend/pgm2/style.css +++ b/fhem/webfrontend/pgm2/style.css @@ -1,146 +1,41 @@ -body { - color: black; - background: #FFFFD7; -} +body { color: black; background: #FFFFD7; } -table.room { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #D7FFFF; -} +table { -moz-border-radius:8px; } -table.room tr.sel { - background: #A0FFFF; -} +table.room { border:thin solid; width: 100%; background: #D7FFFF; } +table.room tr.sel { background: #A0FFFF; } -table.FS20 { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #C0FFFF; -} +table.at { border:thin solid; width: 100%; background: #FFFFC0; } +table.at tr.odd { background: #FFFFD7; } -table.FS20 tr.odd { - background: #D7FFFF; -} +table.notify { border:thin solid; width: 100%; background: #D7D7A0; } +table.notify tr.odd { background: #FFFFC0; } -table.FHT { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #FFC0C0; -} +table.FileLog { border:thin solid; width: 100%; background: #FFC0C0; } +table.FileLog tr.odd { background: #FFD7D7; } -table.FHT tr.odd { - background: #FFD7D7; -} +table._internal_ { border:thin solid; width: 100%; background: #C0C0C0; } +table._internal_ tr.odd { background: #D7D7D7; } -table.KS300 { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #C0FFC0; -} +table.FS20 { border:thin solid; width: 100%; background: #C0FFFF; } +table.FS20 tr.odd { background: #D7FFFF; } -table.KS300 tr.odd { - background: #A7FFA7; -} +table.FHT { border:thin solid; width: 100%; background: #FFC0C0; } +table.FHT tr.odd { background: #FFD7D7; } -table.FileLog { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #FFC0C0; -} +table.KS300 { border:thin solid; width: 100%; background: #C0FFC0; } +table.KS300 tr.odd { background: #A7FFA7; } -table.FileLog tr.odd { - background: #FFD7D7; -} +table.FHZ { border:thin solid; width: 100%; background: #C0C0C0; } +table.FHZ tr.odd { background: #D7D7D7; } -table.at { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #FFFFC0; -} +table.EM { border:thin solid; width: 100%; background: #E0E0E0; } +table.EM tr.odd { background: #F0F0F0; } -table.at tr.odd { - background: #FFFFD7; -} +table.FHEMWEB { border:thin solid; width: 100%; background: #E0E0E0; } +table.FHEMWEB tr.odd { background: #F0F0F0; } -table.notify { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #D7D7A0; -} - -table.notify tr.odd { - background: #FFFFC0; -} - -table.FHZ { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #C0C0C0; -} - -table.FHZ tr.odd { - background: #D7D7D7; -} - -table.EM { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #E0E0E0; -} - -table.EM tr.odd { - background: #F0F0F0; -} - -table._internal_ { - border: solid; - border-width: thin; - width: 100%; - -moz-border-radius:8px; - background: #C0C0C0; -} - -table._internal_ tr.odd { - background: #D7D7D7; -} - -#hdr { - position:absolute; - top:10px; - left:10px; -} - -#left { - position:absolute; - top:50px; - left:10px; - width:130px; -} - -#right { - position:absolute; - top:50px; - left:160px; - right:10px; - bottom:10px; - overflow:auto; -} +#hdr { position:absolute; top:10px; left:10px; } +#left { position:absolute; top:50px; left:10px; width:130px; } +#right { position:absolute; top:50px; left:160px; + right:10px; bottom:10px; overflow:auto; }