2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-11 20:39:47 +00:00

See changes

git-svn-id: https://svn.fhem.de/fhem/trunk@212 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2008-07-24 07:39:15 +00:00
parent 9416535031
commit 4e0b348adc
15 changed files with 134 additions and 166 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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)

View File

@ -46,6 +46,9 @@ me?</a><br><br>
<a href="#faq12">12. I'd like to switch on the ventilator if the FHT tells me its too hot. How to tell fhem to do that?</a><br><br>
<a href="#faq12">13. I'd like to see directly in the Web frontend if a window is open. How to do that?</a><br><br>
<br>
<br>
<br>
<br>
@ -273,5 +276,19 @@ by fhem.pl?</b>
</ul>
<a name="faq13"></a>
<b>13. I'd like to see directly in the Web frontend if a window is open.
How to do that? (by fwolff)</b>
<ul>
Just define a new (pseudo) FS20 device called "window" and use the following
notify settings:
<pre>
define window_open notify bad.*warnings.*Window.*open.* set window on
define window_close notify bad.*warnings.*none.* set window off
</pre>
</ul>
</body>
</html>

View File

@ -42,7 +42,7 @@ Currently implemented features:<br>
encryption.
</li>
<li>reading WS300 data, and up to 9 attached devices</li>
<li>reading EM1000WZ/EM1000EM data via an attached EM1010PC</li>
<li>reading EM1000WZ/EM1000EM/EM1000GZ data via an attached EM1010PC</li>
<li>reading attached SCIVT devices</li>
<li>reading attached M232 devices</li>
<li>reading attached WS2000/WS25000 devices, also via raw network converters(xport)</li>

View File

@ -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

View File

@ -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";

View File

@ -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";
}

View File

@ -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 "<?xml version=\"1.0\" encoding=\"iso8859-1\"?>\n";
pO "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
pO "<?xml-stylesheet href=\"$__ME/svg_style.css\" type=\"text/css\"?>\n";
pO "<!DOCTYPE svg>\n";
pO "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\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 "</svg>\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 "<polyline points=\"$ret\" class=\"l$idx\"/>\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 "<polyline points=\"$ret\" class=\"l$idx\"/>\n";
}
}
pO "</svg>\n";
}

View File

@ -14,7 +14,7 @@ set y2tics
set title '<TL>'
set grid xtics y2tics
set y2label "Temperature in C°"
set y2label "Temperature in C"
set ylabel "Actuator (%)"
#FileLog 4:measured:0:

View File

@ -13,7 +13,7 @@ set y2tics
set title '<TL>'
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:]

View File

@ -13,7 +13,7 @@ set y2tics
set title '<TL>'
set grid
set ylabel "Temperature in C°"
set ylabel "Temperature in C"
set y2label "Rain (l/m2)"
#FileLog 5:avg_day:0:

View File

@ -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; }