diff --git a/CHANGED b/CHANGED index b35fe5770..d5c04d271 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,7 @@ +- SVN + - feature: internal NotifyOrderPrefix: 98_average.pm is more straightforward + + - 2011-12-31 (5.2) - bugfix: applying smallscreen attributes to firefox/opera - feature: CUL_TX added (thanks to Peterp) diff --git a/FHEM/00_CUL.pm b/FHEM/00_CUL.pm index 143707b2d..91aa62754 100755 --- a/FHEM/00_CUL.pm +++ b/FHEM/00_CUL.pm @@ -955,6 +955,8 @@ CUL_Attr(@) my $name = $a[1]; my $hash = $defs{$name}; + $a[3] = "SlowRF" if(!$a[3] || $a[3] ne "HomeMatic"); + if($a[3] eq "HomeMatic") { return if($hash->{initString} =~ m/Ar/); $hash->{Clients} = $clientsHomeMatic; diff --git a/FHEM/92_FileLog.pm b/FHEM/92_FileLog.pm index 0d00457b4..54ace9772 100755 --- a/FHEM/92_FileLog.pm +++ b/FHEM/92_FileLog.pm @@ -155,7 +155,7 @@ FileLog_Set($@) # # It will set the %data values # min, max, avg, cnt, currdate, currval, sum -# for each requested column, beggining with = 1 +# for each requested column, beginning with = 1 sub FileLog_Get($@) diff --git a/FHEM/98_autocreate.pm b/FHEM/98_autocreate.pm index ae59617c1..f1c8bb7e4 100644 --- a/FHEM/98_autocreate.pm +++ b/FHEM/98_autocreate.pm @@ -325,6 +325,10 @@ CommandUsb($$) my $msg; my $dir = "/dev"; + if($^O =~ m/Win/) { + return "This command is not yet supported on windows"; + } + require "$attr{global}{modpath}/FHEM/DevIo.pm"; foreach my $dev (sort split("\n", `ls $dir`)) { diff --git a/FHEM/98_average.pm b/FHEM/98_average.pm index f0e2230d3..e48b0735a 100644 --- a/FHEM/98_average.pm +++ b/FHEM/98_average.pm @@ -13,6 +13,7 @@ average_Initialize($) my ($hash) = @_; $hash->{DefFn} = "average_Define"; $hash->{NotifyFn} = "average_Notify"; + $hash->{NotifyOrderPrefix} = "10-"; # Want to be called before the rest $hash->{AttrList} = "disable:0,1"; } @@ -50,8 +51,8 @@ average_Notify($$) my $re = $avg->{REGEXP}; my $max = int(@{$dev->{CHANGED}}); my $tn; + my $myIdx = $max; - my $trigger = ""; for (my $i = 0; $i < $max; $i++) { my $s = $dev->{CHANGED}[$i]; @@ -100,7 +101,7 @@ average_Notify($$) $r->{$cumName}{VAL} = $cum; $r->{$avgName}{VAL} = sprintf("%0.1f", $cum/$secNow); } else { - $trigger .= " $avgName:".$r->{$avgName}{VAL}; + $dev->{CHANGED}[$myIdx++] = "$avgName: ".$r->{$avgName}{VAL}; $r->{$cumName}{VAL} = $secNow*$val; $r->{$avgName}{VAL} = $val; @@ -108,24 +109,7 @@ average_Notify($$) $r->{$cumName}{TIME} = $r->{$avgName}{TIME} = $tn; } } - $addNotifyCB{"avg:$avgName:$devName"} = "average_Callback $devName $trigger" - if($trigger); - return undef; } -sub -average_Callback($) -{ - my ($arg) = @_; - my ($dev, @list) = split(" ", $arg); - - my $n = 0; - for(my $n = 0; $n < @list; $n++) { - my ($name, $value) = split(":", $list[$n]); - $defs{$dev}{CHANGED}[$n] = "$name: $value"; - } - DoTrigger($dev, undef); -} - 1; diff --git a/FHEM/99_updatefhem.pm b/FHEM/99_updatefhem.pm index eb76a1f7b..ab336d470 100644 --- a/FHEM/99_updatefhem.pm +++ b/FHEM/99_updatefhem.pm @@ -41,34 +41,37 @@ CommandUpdatefhem($$) my @commandchain = split(/ +/,$param); # Check if the first parameter is "backup" - if(uc($commandchain[0]) eq "BACKUP") { - my $backupdir = AttrVal("global", "backupdir", "/tmp/FHEM_Backup"); - # create the backupfolder - if(!-d $backupdir) { - if(!mkdir($backupdir)) { - return "Can't create backup folder $!"; - } - } - # full backup, for compatibility, we use the native copy unction, not - # dircopy from File::Copy::Recursive - if($commandchain[1] eq "") { - opendir(IMD, $moddir) || return "Cannot open fhem-module directory"; - my @files= readdir(IMD); - closedir(IMD); - my $f; - - foreach $f (@files) { - unless ( ($f eq ".") || ($f eq "..") ) { - my $ret = copy("$moddir/$f", "$backupdir/$f"); + if($param) { + my @commandchain = split(/ +/,$param); + if(uc($commandchain[0]) eq "BACKUP") { + my $backupdir = AttrVal("global", "backupdir", "/tmp/FHEM_Backup"); + # create the backupfolder + if(!-d $backupdir) { + if(!mkdir($backupdir)) { + return "Can't create backup folder $!"; } } - $param = ""; + # full backup, for compatibility, we use the native copy unction, not + # dircopy from File::Copy::Recursive + if($commandchain[1] eq "") { + opendir(IMD, $moddir) || return "Cannot open fhem-module directory"; + my @files= readdir(IMD); + closedir(IMD); + my $f; - } else { - # one file backup - copy("$moddir/$commandchain[1]", "$backupdir/$commandchain[1]"); - # recreate $param for further use - $param = $commandchain[1]; + foreach $f (@files) { + unless ( ($f eq ".") || ($f eq "..") ) { + my $ret = copy("$moddir/$f", "$backupdir/$f"); + } + } + $param = ""; + + } else { + # one file backup + copy("$moddir/$commandchain[1]", "$backupdir/$commandchain[1]"); + # recreate $param for further use + $param = $commandchain[1]; + } } } diff --git a/Makefile b/Makefile index b65e5373b..77f61ecd0 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ dist: find .f -name .svn -print | xargs rm -rf find .f -name \*.orig -print | xargs rm -f find .f -name .#\* -print | xargs rm -f - find .f -type f -print |\ + find .f -type f -print | grep -v Makefile |\ xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g' mv .f $(DESTDIR) tar cf - $(DESTDIR) | gzip > $(DESTDIR).tar.gz @@ -77,7 +77,7 @@ deb: find .f -name .svn -print | xargs rm -rf find .f -name \*.orig -print | xargs rm -f find .f -name .#\* -print | xargs rm -f - find .f -type f -print |\ + find .f -type f -print | grep -v Makefile |\ xargs perl -pi -e 's/=VERS=/$(VERS)/g;s/=DATE=/$(DATE)/g' find .f -type f | xargs chmod 644 find .f -type d | xargs chmod 755 @@ -90,3 +90,6 @@ deb: fb7390: cd contrib/FB7390 && ./makeimage $(DESTDIR) + +fb7270: + cd contrib/FB7270 && ./makeimage $(DESTDIR) diff --git a/contrib/fhemupdate.pl b/contrib/fhemupdate.pl index 2002e9fbb..f77a16f88 100755 --- a/contrib/fhemupdate.pl +++ b/contrib/fhemupdate.pl @@ -3,15 +3,29 @@ # Server-Side script to check out the fhem SVN repository, and upload the # changed files to the server +$ENV{CVS_RSH}="/usr/bin/ssh"; + +print "\n\n"; print localtime() . "\n"; +chdir("/home/rudi/fhemupdate/culfw"); +system("svn update ."); chdir("/home/rudi/fhemupdate/fhem"); system("mkdir -p UPLOAD"); -system("svn update . > /dev/null 2>&1"); +system("svn update ."); die "SVN failed, exiting\n" if($?); +my $ndiff = `diff fhem.pl fhem.pl.txt | wc -l`; +if($ndiff != 4) { # more than the standard stuff is different + print "Modifying fhem.pl: >$ndiff<\n"; + system('perl -p -e "s/=DATE=/"`date +"%Y-%m-%d"`"/;'. + 's/=VERS=/"`grep ^VERS= Makefile | '. + 'sed -e s/VERS=//`"+SVN/" fhem.pl > fhem.pl.txt'); +} + + my @filelist = ( - "./fhem.pl", + "./fhem.pl.txt", "FHEM/.*.pm", "webfrontend/pgm2/.*", "docs/commandref.html", @@ -19,6 +33,7 @@ my @filelist = ( "docs/HOWTO.html", "docs/fhem.*.png", "docs/.*.jpg", + "../culfw/Devices/CUL/.*.hex", ); # Read in the file timestamps @@ -45,6 +60,7 @@ if(open FH, "UPLOAD/filetimes.txt") { while(my $l = ) { chomp($l); my ($ts, $fs, $file) = split(" ", $l, 3); + $oldtime{"$file.txt"} = $ts if($file eq "fhem.pl"); $oldtime{$file} = $ts; } close(FH); @@ -58,12 +74,14 @@ print FTP "put filetimes.txt\n"; print FTP "pas\n"; # Without passive only 28 files can be transferred my $cnt; foreach my $f (sort keys %filetime) { - print FH "$filetime{$f} $filesize{$f} $f\n"; + my $fn = $f; + $fn =~ s/.txt$// if($fn =~ m/.pl.txt$/); + print FH "$filetime{$f} $filesize{$f} $fn\n"; + my $newfname = $f; - $newfname .= ".txt" if($newfname =~ m/.pl$/); # Cant download .pl files if(!$oldtime{$f} || $oldtime{$f} ne $filetime{$f}) { - print FTP "put $newfname\n"; - system("cp ../$filedir{$f}/$f $newfname"); + print FTP "put $f\n"; + system("cp ../$filedir{$f}/$f $f"); $cnt++; } } diff --git a/docs/commandref.html b/docs/commandref.html index 2e957ed66..8162faab6 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -505,7 +505,7 @@ A line ending with \ will be concatenated with the next one, so long lines
getstate fl
ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...] measured-temp:22.9 [...] - + Note: to use this command copy the file contrib/getstate/99_getstate.pm into your FHEM directory.
@@ -1099,7 +1099,9 @@ A line ending with \ will be concatenated with the next one, so long lines Specify the logfile to write. You can use "-" for stdout, in this case the server won't background itself.
The logfile name can also take wildcards for easier logfile rotation, - see the FileLog section. + see the FileLog section. Just apply the + archivecmd / archivedir / nrarchive attributes to the + global device as you would do for a FileLog device.
@@ -7654,9 +7656,10 @@ href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=29870">U shell command (no enclosing " is needed), and each % in the command will be replaced with the name of the old logfile.
- If this attribute is not set, but nrarchive and/or archivecmd is set, - then all superfluous logfiles will be moved to archivedir (or deleted if - archivedir is not set).
+ If this attribute is not set, but nrarchive and/or archivecmd are set, + then nrarchive logfiles are kept while older ones are moved to + archivedir (or deleted if archivedir is not set). +
  • disable
  • diff --git a/fhem.pl b/fhem.pl index 6e3e03eee..67989d9ac 100755 --- a/fhem.pl +++ b/fhem.pl @@ -1148,12 +1148,13 @@ CommandDefine($$) { my ($cl, $def) = @_; my @a = split("[ \t][ \t]*", $def, 3); + my $name = $a[0]; return "Usage: define " if(int(@a) < 2); - return "$a[0] already defined, delete it first" if(defined($defs{$a[0]})); - return "Invalid characters in name (not A-Za-z0-9.:_): $a[0]" - if($a[0] !~ m/^[a-z0-9.:_]*$/i); + return "$name already defined, delete it first" if(defined($defs{$name})); + return "Invalid characters in name (not A-Za-z0-9.:_): $name" + if($name !~ m/^[a-z0-9.:_]*$/i); my $m = $a[1]; if(!$modules{$m}) { # Perhaps just wrong case? @@ -1175,7 +1176,7 @@ CommandDefine($$) my %hash; - $hash{NAME} = $a[0]; + $hash{NAME} = $name; $hash{TYPE} = $m; $hash{STATE} = "???"; $hash{DEF} = $a[2] if(int(@a) > 2); @@ -1183,19 +1184,24 @@ CommandDefine($$) # If the device wants to issue initialization gets/sets, then it needs to be # in the global hash. - $defs{$a[0]} = \%hash; + $defs{$name} = \%hash; - my $ret = CallFn($a[0], "DefFn", \%hash, $def); + my $ret = CallFn($name, "DefFn", \%hash, $def); if($ret) { Log 1, "define: $ret"; - delete $defs{$a[0]}; # Veto - delete $attr{$a[0]}; + delete $defs{$name}; # Veto + delete $attr{$name}; } else { foreach my $da (sort keys (%defaultattr)) { # Default attributes - CommandAttr($cl, "$a[0] $da $defaultattr{$da}"); + CommandAttr($cl, "$name $da $defaultattr{$da}"); + } + DoTrigger("global", "DEFINED $name"); + + if($modules{$m}{NotifyFn} && !$hash{NTFY_ORDER}) { + $hash{NTFY_ORDER} = ($modules{$m}{NotifyOrderPrefix} ? + $modules{$m}{NotifyOrderPrefix} : "50-") . $name; } - DoTrigger("global", "DEFINED $a[0]"); } return $ret; @@ -2099,8 +2105,26 @@ DoTrigger($$) Log 5, "Triggering $dev ($max changes)"; return "" if(defined($attr{$dev}) && defined($attr{$dev}{do_not_notify})); + ################ + # Log/notify modules + # If modifying a device in its own trigger, do not call the triggers from + # the inner loop. + if(!defined($defs{$dev}{INTRIGGER})) { + $defs{$dev}{INTRIGGER}=1; + my @ntfyList = sort { $defs{$a}{NTFY_ORDER} cmp $defs{$b}{NTFY_ORDER} } + grep { $defs{$_}{NTFY_ORDER} } keys %defs; + foreach my $n (@ntfyList) { + next if(!defined($defs{$n})); # Was deleted in a previous notify + Log 5, "$dev trigger: Checking $n for notify"; + my $r = CallFn($n, "NotifyFn", $defs{$n}, $defs{$dev}); + $ret .= $r if($r); + } + delete($defs{$dev}{INTRIGGER}); + } + ################ # Inform + $max = int(@{$defs{$dev}{CHANGED}}); # can be enriched in the notifies foreach my $c (keys %client) { # Do client loop first, is cheaper next if(!$client{$c}{inform} || $client{$c}{inform} eq "raw"); my $tn = TimeNow(); @@ -2118,24 +2142,6 @@ DoTrigger($$) } } - ################ - # Log/notify modules - # If modifying a device in its own trigger, do not call the triggers from - # the inner loop. - if(!defined($defs{$dev}{INTRIGGER})) { - $defs{$dev}{INTRIGGER}=1; - foreach my $n (sort keys %defs) { - next if(!defined($defs{$n})); # Was deleted in a previous notify - if(defined($modules{$defs{$n}{TYPE}})) { - if($modules{$defs{$n}{TYPE}}{NotifyFn}) { - Log 5, "$dev trigger: Checking $n for notify"; - my $r = CallFn($n, "NotifyFn", $defs{$n}, $defs{$dev}); - $ret .= $r if($r); - } - } - } - delete($defs{$dev}{INTRIGGER}); - } #################### # Used by triggered perl programs to check the old value @@ -2147,20 +2153,6 @@ DoTrigger($$) Log 3, "NTFY return: $ret" if($ret); - # Enhancers like avarage need this - if(!defined($defs{$dev}{InNtfyCb}) && %addNotifyCB) { - $defs{$dev}{InNtfyCb}=1; - foreach my $cb (keys %addNotifyCB) { - my ($fn, $arg) = split(" ", $addNotifyCB{$cb}, 2); - delete $addNotifyCB{$cb}; - no strict "refs"; - &{$fn}($arg); - use strict "refs"; - } - delete($defs{$dev}{CHANGED}); - delete($defs{$dev}{InNtfyCb}); - } - return $ret; } diff --git a/webfrontend/pgm2/01_FHEMWEB.pm b/webfrontend/pgm2/01_FHEMWEB.pm index 875443b51..de85edf78 100755 --- a/webfrontend/pgm2/01_FHEMWEB.pm +++ b/webfrontend/pgm2/01_FHEMWEB.pm @@ -32,9 +32,9 @@ sub FW_textfield($$); sub FW_updateHashes(); sub FW_zoomLink($$$); sub pF($@); -sub pH(@); -sub pHPlain(@); -sub pO(@); +sub FW_pH(@); +sub FW_pHPlain(@); +sub FW_pO(@); use vars qw($FW_dir); # moddir (./FHEM), needed by SVG use vars qw($FW_ME); # webname (default is fhem), needed by 97_GROUP @@ -337,7 +337,7 @@ FW_AnswerCall($) my $f = $1; $f =~ s,/,,g; # little bit of security open(FH, "$FW_dir/$f") || return 0; - pO join("", ); + FW_pO join("", ); close(FH); $FW_RETTYPE = "text/plain; charset=$FW_encoding" if($f !~ m/\.*html$/); return 1; @@ -349,7 +349,7 @@ FW_AnswerCall($) $prf = "touchpad" if(!$prf && $FW_tp); return 0 if(!open(FH, "$FW_dir/$prf$cssName.css") && !open(FH, "$FW_dir/$cssName.css")); - pO join("", ); + FW_pO join("", ); close(FH); $FW_RETTYPE = "text/css"; return 1; @@ -365,7 +365,7 @@ FW_AnswerCall($) return 0 if(!$img || !open(FH, "$FW_dir/$img")); } binmode (FH); # necessary for Windows - pO join("", ); + FW_pO join("", ); close(FH); my @f_ext = split(/\./,$img); #kpb $FW_RETTYPE = "image/$f_ext[-1]"; @@ -373,7 +373,7 @@ FW_AnswerCall($) } elsif($arg =~ m,^$FW_ME/(.*).js,) { #kpb java include open(FH, "$FW_dir/$1.js") || return 0; - pO join("", ); + FW_pO join("", ); close(FH); $FW_RETTYPE = "application/javascript"; return 1; @@ -412,10 +412,11 @@ FW_AnswerCall($) $FW_tp ? "640,160" : "800,160"); $FW_reldoc = "$FW_ME/commandref.html"; - $FW_cmdret = $docmd ? fC($cmd) : ""; + $FW_cmdret = $docmd ? FW_fC($cmd) : ""; if($FW_inform) { # Longpoll header $defs{$FW_cname}{inform} = $FW_room; + $defs{$FW_cname}{NTFY_ORDER} = $FW_cname; # else notifyfn won't be called my $c = $defs{$FW_cname}{CD}; print $c "HTTP/1.1 200 OK\r\n", "Content-Type: text/plain; charset=$FW_encoding\r\n\r\n"; @@ -424,7 +425,7 @@ FW_AnswerCall($) if($FW_XHR) { $FW_RETTYPE = "text/plain; charset=$FW_encoding"; - pO $FW_cmdret; + FW_pO $FW_cmdret; return 0; } @@ -446,7 +447,7 @@ FW_AnswerCall($) } $defs{$aa[0]}{currentlogfile} =~ m,([^/]*)$,; $aa[2] = "CURRENT" if($1 eq $aa[2]); - $FW_cmdret = fC("define wl_$max weblink fileplot $aa[0]:$aa[1]:$aa[2]"); + $FW_cmdret = FW_fC("define wl_$max weblink fileplot $aa[0]:$aa[1]:$aa[2]"); if(!$FW_cmdret) { $FW_detail = "wl_$max"; FW_updateHashes(); @@ -455,44 +456,44 @@ FW_AnswerCall($) my $t = AttrVal("global", "title", "Home, Sweet Home"); - pO ''; - pO ''; - pO "\n$t"; + FW_pO ''; + FW_pO ''; + FW_pO "\n$t"; # Enable WebApp if($FW_tp || $FW_ss) { - pO ''; - pO ''; - #pO '' + FW_pO ''; + FW_pO ''; + #FW_pO '' if($FW_ss) { - pO ''; + FW_pO ''; } elsif($FW_tp) { - pO ''; + FW_pO ''; } } my $rf = AttrVal($FW_wname, "refresh", ""); - pO "" if($rf); - pO ""; - pO "" + FW_pO "" if($rf); + FW_pO ""; + FW_pO "" if($FW_plotmode eq "SVG"); - pO "" + FW_pO "" if($FW_longpoll); - pO "\n"; + FW_pO "\n"; if($FW_cmdret) { $FW_detail = ""; $FW_room = ""; $FW_cmdret =~ s//>/g; - pO "
    "; + FW_pO "
    "; $FW_cmdret = "
    $FW_cmdret
    " if($FW_cmdret =~ m/\n/); if($FW_ss) { - pO "
    $FW_cmdret
    "; + FW_pO "
    $FW_cmdret
    "; } else { - pO $FW_cmdret; + FW_pO $FW_cmdret; } - pO "
    "; + FW_pO "
    "; } FW_roomOverview($cmd); @@ -500,7 +501,7 @@ FW_AnswerCall($) FW_doDetail($FW_detail) if($FW_detail); FW_showRoom() if($FW_room && !$FW_detail); FW_logWrapper($cmd) if($cmd =~ /^logwrapper/); - pO ""; + FW_pO ""; return 0; } @@ -584,7 +585,7 @@ FW_makeTable($$@) my($name, $hash, $cmd) = (@_); return if(!$hash || !int(keys %{$hash})); - pO ""; + FW_pO "
    "; my $row = 1; foreach my $n (sort keys %{$hash}) { @@ -600,33 +601,33 @@ FW_makeTable($$@) } else { - pO ""; + FW_pO ""; if(ref($val)) { my ($v, $t) = ($val->{VAL}, $val->{TIME}); if($FW_ss) { $t = ($t ? "
    $t
    " : ""); - pO ""; + FW_pO ""; } else { $t = "" if(!$t); - pO ""; + FW_pO ""; } } else { - pO ""; + FW_pO ""; } } - pH "cmd.$name=$cmd $name $n&detail=$name", $cmd, 1 + FW_pH "cmd.$name=$cmd $name $n&detail=$name", $cmd, 1 if($cmd && !$FW_ss); - pO ""; + FW_pO ""; } - pO "
    $n
    $n
    $v$t
    $v$t
    $v$t$v$t
    $val
    $val
    "; - pO "
    "; + FW_pO ""; + FW_pO "
    "; } @@ -638,13 +639,13 @@ FW_makeSelect($$$) return if(!$list || $FW_hiddenroom{input}); my @al = map { s/[:;].*//;$_ } split(" ", $list); - pO "
    "; - pO FW_hidden("detail", $d); - pO FW_hidden("dev.$cmd$d", $d); - pO FW_submit("cmd.$cmd$d", $cmd) . " $d"; - pO FW_select("arg.$cmd$d",\@al,undef); - pO FW_textfield("val.$cmd$d", 30); - pO "
    "; + FW_pO "
    "; + FW_pO FW_hidden("detail", $d); + FW_pO FW_hidden("dev.$cmd$d", $d); + FW_pO FW_submit("cmd.$cmd$d", $cmd) . " $d"; + FW_pO FW_select("arg.$cmd$d",\@al,undef); + FW_pO FW_textfield("val.$cmd$d", 30); + FW_pO "
    "; } @@ -654,35 +655,35 @@ FW_doDetail($) { my ($d) = @_; - pO "
    "; - pO FW_hidden("detail", $d); + FW_pO ""; + FW_pO FW_hidden("detail", $d); my $t = $defs{$d}{TYPE}; - pO "
    "; - pO "
    "; + FW_pO "
    "; + FW_pO "
    "; FW_makeSelect($d, "set", getAllSets($d)); FW_makeTable($d, $defs{$d}); - pO "Readings" if($defs{$d}{READINGS}); + FW_pO "Readings" if($defs{$d}{READINGS}); FW_makeTable($d, $defs{$d}{READINGS}); FW_makeSelect($d, "attr", getAllAttr($d)); FW_makeTable($d, $attr{$d}, "deleteattr"); if($t eq "FileLog" ) { - pO ""; + FW_pO "
    "; FW_dumpFileLog($d, 0, 1); - pO "
    "; + FW_pO "
    "; } - pO "
    "; + FW_pO ""; FW_showWeblink($d, $defs{$d}{LINK}, $defs{$d}{WLTYPE}, 1) if($t eq "weblink"); - pO "

    "; - pH "$FW_reldoc#${t}", "Device specific help"; - pO "

    "; - pO "
    "; - pO "
    "; + FW_pO "

    "; + FW_pH "$FW_reldoc#${t}", "Device specific help"; + FW_pO "

    "; + FW_pO ""; + FW_pO ""; } @@ -705,30 +706,30 @@ FW_roomOverview($) $FW_room = AttrVal($FW_detail, "room", undef); $FW_room = $1 if($FW_room && $FW_room =~ m/^([^,]*),/); $FW_room = "" if(!$FW_room); - pHPlain "room=$FW_room", + FW_pHPlain "room=$FW_room", "
    "; - pO "
    $FW_detail details
    "; + FW_pO "
    $FW_detail details
    "; return; } else { - pO "
    "; + FW_pO "
    "; } ############## # HEADER - pO "
    "; - pO '
    '; - pO "
    "; - pO FW_hidden("room", "$FW_room") if($FW_room); - pO FW_textfield("cmd", $FW_ss ? 25 : 40); + FW_pO "
    "; + FW_pO '
    '; + FW_pO ""; + FW_pO FW_hidden("room", "$FW_room") if($FW_room); + FW_pO FW_textfield("cmd", $FW_ss ? 25 : 40); if(!$FW_ss && !$FW_hiddenroom{save}) { - pO "
    " . FW_submit("cmd", "save"); + FW_pO "
    " . FW_submit("cmd", "save"); } - pO "
    "; - pO "
    "; - pO "
    "; + FW_pO ""; + FW_pO "
    "; + FW_pO "
    "; ############## # MENU @@ -776,46 +777,46 @@ FW_roomOverview($) } - pO "
    "; - pO ""; + FW_pO "
    "; + FW_pO "
    "; if($FW_ss) { # Make a selection sensitive dropdown list - pO ""; + FW_pO ""; if(!$FW_hiddenroom{save}) { - pO ""; } - pO ""; + FW_pO ""; } else { foreach(my $idx = 0; $idx < @list1; $idx++) { my ($l1, $l2) = ($list1[$idx], $list2[$idx]); if(!$l1) { - pO "
    " . + FW_pO "
    " . FW_submit("cmd", "save"). "
    " if($idx); - pO "" + FW_pO "
    " if($idx); + FW_pO "" if($idx", $l1 eq $FW_room ? " class=\"sel\"" : ""; if($l2 =~ m/.html$/ || $l2 =~ m/^http/) { - pO ""; + FW_pO ""; } else { - pH $l2, $l1, 1; + FW_pH $l2, $l1, 1; } - pO ""; + FW_pO ""; } } } - pO "
    $l1$l1
    "; - pO "
    "; + FW_pO ""; + FW_pO ""; } @@ -829,9 +830,9 @@ FW_showRoom() # (re-) list the icons FW_ReadIcons(); - pO "
    "; - pO "
    "; - pO ""; # Need for equal width of subtables + FW_pO ""; + FW_pO "
    "; + FW_pO "
    "; # Need for equal width of subtables my $rf = ($FW_room ? "&room=$FW_room" : ""); # stay in the room @@ -847,9 +848,9 @@ FW_showRoom() !IsIgnored($_) } keys %{$FW_types{$type}}; next if(!@devs); - pO "\n"; - pO ""; } - pO "
    $type
    "; - pO ""; + FW_pO "\n"; + FW_pO ""; + FW_pO "
    $type
    "; + FW_pO ""; foreach my $d (sort @devs) { my $type = $defs{$d}{TYPE}; @@ -857,23 +858,23 @@ FW_showRoom() pF "\n", ($row&1)?"odd":"even"; my $devName = AttrVal($d, "alias", $d); if($FW_hiddenroom{detail}) { - pO ""; + FW_pO ""; } else { - pH "detail=$d", $devName, 1, "col1"; + FW_pH "detail=$d", $devName, 1, "col1"; } $row++; my ($allSets, $cmdlist, $txt) = FW_devState($d, $rf); - pO ""; + FW_pO ""; if($cmdlist) { foreach my $cmd (split(":", $cmdlist)) { - pH "cmd.$d=set $d $cmd$rf", ReplaceEventMap($d,$cmd,1), 1, "col3"; + FW_pH "cmd.$d=set $d $cmd$rf", ReplaceEventMap($d,$cmd,1), 1, "col3"; } } elsif($allSets =~ m/ desired-temp /) { @@ -884,7 +885,7 @@ FW_showRoom() shift(@tv); # 5.0 is not valid $txt = int($txt*20)/$txt if($txt =~ m/^[0-9].$/); - pO ""; + FW_pO ""; } - pO "
    $devName
    $devName
    $txt"; + FW_pO "$txt"; if(!$FW_ss) { - pO "". + FW_pO "". FW_hidden("arg.$d", "desired-temp") . FW_hidden("dev.$d", $d) . FW_select("val.$d", \@tv, ReadingsVal($d, "desired-temp", $txt)) . @@ -896,12 +897,12 @@ FW_showRoom() } } - pO "
    "; - pO "
    "; + FW_pO "

    "; + FW_pO "
    "; # Now the weblinks my $buttons = 1; @@ -913,8 +914,8 @@ FW_showRoom() $buttons = FW_showWeblink($d, $defs{$d}{LINK}, $defs{$d}{WLTYPE}, $buttons); } - pO "
    "; - pO "
    "; + FW_pO ""; + FW_pO ""; } ################# @@ -952,7 +953,7 @@ FW_logWrapper($) $path = AttrVal($d,"archivedir","") . "/$file" if(!-f $path); if(!open(FH, $path)) { - pO "
    $path: $!
    "; + FW_pO "
    $path: $!
    "; return; } binmode (FH); # necessary for Windows @@ -961,37 +962,37 @@ FW_logWrapper($) $cnt =~ s//>/g; - pO "
    "; - pO "
    " if($FW_ss); - pO "
    $cnt
    "; - pO "
    " if($FW_ss); - pO "
    "; + FW_pO "
    "; + FW_pO "
    " if($FW_ss); + FW_pO "
    $cnt
    "; + FW_pO "
    " if($FW_ss); + FW_pO "
    "; } else { - pO "
    "; - pO "
    "; + FW_pO "
    "; + FW_pO "
    "; FW_zoomLink("cmd=$cmd;zoom=-1", "Zoom-in.png", "zoom in"); FW_zoomLink("cmd=$cmd;zoom=1", "Zoom-out.png","zoom out"); FW_zoomLink("cmd=$cmd;off=-1", "Prev.png", "prev"); FW_zoomLink("cmd=$cmd;off=1", "Next.png", "next"); - pO ""; + FW_pO "
    "; - pO ""; + FW_pO ""; - pO "
    "; + FW_pO ""; my $wl = "&pos=" . join(";", map {"$_=$FW_pos{$_}"} keys %FW_pos); my $arg = "$FW_ME?cmd=showlog undef $d $type $file$wl"; if(AttrVal($d,"plotmode",$FW_plotmode) eq "SVG") { my ($w, $h) = split(",", AttrVal($d,"plotsize",$FW_plotsize)); - pO "\n"; } else { - pO ""; + FW_pO ""; } - pO "
    "; - pH "cmd=toweblink $d:$type:$file", "Convert to weblink"; - pO "
    "; - pO ""; + FW_pO "
    "; + FW_pH "cmd=toweblink $d:$type:$file", "Convert to weblink"; + FW_pO "
    "; + FW_pO "
    "; } } @@ -1031,7 +1032,11 @@ FW_substcfg($$$$$$) my $oll = $attr{global}{verbose}; $attr{global}{verbose} = 0; # Else the filenames will be Log'ged - my $title = AttrVal($wl, "title", "\"$file\""); + + my $fileesc = $file; + $fileesc =~ s/\\/\\\\/g; # For Windows, by MarkusRR + my $title = AttrVal($wl, "title", "\"$fileesc\""); + $title = AnalyzeCommand(undef, "{ $title }"); my $label = AttrVal($wl, "label", undef); my @g_label; @@ -1091,9 +1096,9 @@ FW_showLog($) if($pm =~ m/SVG/) { # FW_fatal for SVG: $FW_RETTYPE = "image/svg+xml"; - pO ''; - pO ''.$msg.''; - pO ''; + FW_pO ''; + FW_pO ''.$msg.''; + FW_pO ''; return; } else { @@ -1142,7 +1147,7 @@ FW_showLog($) my ($f,$t)=($FW_devs{$d}{from}, $FW_devs{$d}{to}); my $oll = $attr{global}{verbose}; $attr{global}{verbose} = 0; # Else the filenames will be Log'ged - my @path = split(" ", fC("get $d $file $tmpfile $f $t " . + my @path = split(" ", FW_fC("get $d $file $tmpfile $f $t " . join(" ", @{$flog}))); $attr{global}{verbose} = $oll; @@ -1170,7 +1175,7 @@ FW_showLog($) $FW_RETTYPE = "image/png"; open(FH, "$tmpfile.png"); # read in the result and send it binmode (FH); # necessary for Windows - pO join("", ); + FW_pO join("", ); close(FH); unlink("$tmpfile.png"); @@ -1188,7 +1193,7 @@ FW_showLog($) $ret = CommandReload(undef, "98_SVG"); Log 0, $ret if($ret); } - $ret = fC("get $d $file INT $f $t " . join(" ", @{$flog})); + $ret = FW_fC("get $d $file INT $f $t " . join(" ", @{$flog})); ($cfg, $plot) = FW_substcfg(1, $wl, $cfg, $plot, $file, ""); SVG_render($wl, $f, $t, $cfg, $internal_data, $plot, $FW_wname); $FW_RETTYPE = "image/svg+xml"; @@ -1202,7 +1207,7 @@ sub FW_fatal($) { my ($msg) = @_; - pO "$msg"; + FW_pO "$msg"; } ################## @@ -1301,8 +1306,8 @@ FW_zoomLink($$$) } - pO "  "; - pHPlain "$cmd", "\"$alt\""; } @@ -1418,38 +1423,38 @@ FW_style($$) # push(@fl, ""); # push(@fl, FW_fileList("$FW_dir/.*html")); - pO $start; - pO "$msg

    " if($msg); - pO ""; + FW_pO $start; + FW_pO "$msg

    " if($msg); + FW_pO "
    "; my $row = 0; foreach my $file (@fl) { - pO ""; + FW_pO ""; if($file eq "") { - pO ""; + FW_pO ""; } else { - pH "cmd=style edit $file", $file, 1; + FW_pH "cmd=style edit $file", $file, 1; } - pO ""; + FW_pO ""; $row = ($row+1)%2; } - pO "


    $end"; + FW_pO "$end"; } elsif($a[1] eq "select") { my @fl = FW_fileList("$FW_dir/.*style.css"); - pO "$start"; + FW_pO "$start
    "; my $row = 0; foreach my $file (@fl) { next if($file =~ m/(svg_|smallscreen|touchpad)style.css/); $file =~ s/style.css//; $file = "Default" if($file eq ""); - pO ""; - pH "cmd=style set $file", "$file", 1; - pO ""; + FW_pO ""; + FW_pH "cmd=style set $file", "$file", 1; + FW_pO ""; $row = ($row+1)%2; } - pO "
    $end"; + FW_pO "$end"; } elsif($a[1] eq "set") { if($a[2] eq "Default") { @@ -1457,20 +1462,20 @@ FW_style($$) } else { $attr{$FW_wname}{stylesheetPrefix} = $a[2]; } - pO "${start}Reload the page in the browser.$end"; + FW_pO "${start}Reload the page in the browser.$end"; } elsif($a[1] eq "examples") { my @fl = FW_fileList("$FW_dir/example.*"); - pO "$start"; + FW_pO "$start
    "; my $row = 0; foreach my $file (@fl) { - pO ""; - pO ""; - pO ""; + FW_pO ""; + FW_pO ""; + FW_pO ""; $row = ($row+1)%2; } - pO "
    $file
    $file
    $end"; + FW_pO "$end"; } elsif($a[1] eq "edit") { @@ -1478,26 +1483,26 @@ FW_style($$) my $f = ($a[2] eq "fhem.cfg" ? $attr{global}{configfile} : "$FW_dir/$a[2]"); if(!open(FH, $f)) { - pO "$f: $!"; + FW_pO "$f: $!"; return; } my $data = join("", ); close(FH); my $ncols = $FW_ss ? 40 : 80; - pO "
    "; - pO "
    "; + FW_pO "
    "; + FW_pO ""; $f =~ s,^.*/,,; - pO FW_submit("save", "Save $f"); - pO "  "; - pO FW_submit("saveAs", "Save as"); - pO FW_textfield("saveName", 30); - pO "

    "; - pO FW_hidden("cmd", "style save $a[2]"); - pO ""; - pO ""; - pO "
    "; + FW_pO ""; + FW_pO "
    "; } elsif($a[1] eq "save") { my $fName = $a[2]; @@ -1507,7 +1512,7 @@ FW_style($$) $fName = ($fName eq "fhem.cfg" ? $attr{global}{configfile} : "$FW_dir/$fName"); if(!open(FH, ">$fName")) { - pO "$fName: $!"; + FW_pO "$fName: $!"; return; } $FW_data =~ s/\r//g if($^O !~ m/Win/); @@ -1515,7 +1520,7 @@ FW_style($$) print FH $FW_data; close(FH); FW_style("style list", "Saved the file $fName"); - fC("rereadcfg") if($fName eq $attr{global}{configfile}); + FW_fC("rereadcfg") if($fName eq $attr{global}{configfile}); } } @@ -1523,7 +1528,7 @@ FW_style($$) ################## # print (append) to output sub -pO(@) +FW_pO(@) { my $arg = shift; return if(!defined($arg)); @@ -1534,36 +1539,36 @@ pO(@) ################# # add href sub -pH(@) +FW_pH(@) { my ($link, $txt, $td, $class) = @_; - pO "" if($td); + FW_pO "" if($td); $link = ($link =~ m,^/,) ? $link : "$FW_ME?$link"; $class = "" if(!defined($class)); $class = " class=\"$class\"" if($class); if($FW_ss || $FW_tp) { # No pointer change if using onClick - pO "$txt
    "; + FW_pO "$txt"; } else { - pO "$txt"; + FW_pO "$txt"; } - pO "" if($td); + FW_pO "" if($td); } sub -pHPlain(@) +FW_pHPlain(@) { my ($link, $txt, $td) = @_; - pO "" if($td); + FW_pO "" if($td); if($FW_ss || $FW_tp) { - pO "$txt"; + FW_pO "$txt"; } else { - pO "$txt"; + FW_pO "$txt"; } - pO "" if($td); + FW_pO "" if($td); } @@ -1580,7 +1585,7 @@ pF($@) ################## # fhem command sub -fC($) +FW_fC($) { my ($cmd) = @_; my $ret = AnalyzeCommand(undef, $cmd); @@ -1596,19 +1601,19 @@ FW_showWeblink($$$$) my $attr = AttrVal($d, "htmlattr", ""); if($t eq "link") { - pO "$d"; # no pH, want to open extra browser + FW_pO "$d"; # no FW_pH, want to open extra browser } elsif($t eq "image") { - pO "
    "; - pO "
    "; - pHPlain "detail=$d", $d; - pO "
    "; + FW_pO "
    "; + FW_pO "
    "; + FW_pHPlain "detail=$d", $d; + FW_pO "
    "; } elsif($t eq "iframe") { - pO ""; - pO "
    "; - pHPlain "detail=$d", $d; - pO "
    "; + FW_pO ""; + FW_pO "
    "; + FW_pHPlain "detail=$d", $d; + FW_pO "
    "; } elsif($t eq "fileplot") { @@ -1623,12 +1628,12 @@ FW_showWeblink($$$$) FW_zoomLink("off=-1", "Prev.png", "prev"); FW_zoomLink("off=1", "Next.png", "next"); $buttons = 0; - pO "
    "; + FW_pO "
    "; } my @va = split(":", $v, 3); if(@va != 3 || !$defs{$va[0]} || !$defs{$va[0]}{currentlogfile}) { - pO "Broken definition: $v
    "; + FW_pO "Broken definition: $v
    "; } else { if($va[2] eq "CURRENT") { @@ -1641,16 +1646,16 @@ FW_showWeblink($$$$) my $arg="$FW_ME?cmd=showlog $d $va[0] $va[1] $va[2]$wl"; if(AttrVal($d,"plotmode",$FW_plotmode) eq "SVG") { my ($w, $h) = split(",", AttrVal($d,"plotsize",$FW_plotsize)); - pO "\n"; } else { - pO ""; + FW_pO ""; } - pO "
    "; - pHPlain "detail=$d", $d; - pO "
    "; + FW_pO "
    "; + FW_pHPlain "detail=$d", $d; + FW_pO "
    "; } } @@ -1724,26 +1729,26 @@ FW_makeEdit($$$) "s.display = s.display=='none' ? 'block' : 'none';". "s=document.getElementById('disp').style;". "s.display = s.display=='none' ? 'block' : 'none';"; - pO ""; - pO "$n"; - pO ""; + FW_pO ""; + FW_pO "$n"; + FW_pO ""; $val =~ s,\\\n,\n,g; my $eval = $val; $eval = "
    $eval
    " if($eval =~ m/\n/); - pO ""; - pO "
    $eval
    "; - pO ""; + FW_pO ""; + FW_pO "
    $eval
    "; + FW_pO ""; - pO ""; - pO "
    "; + FW_pO ""; + FW_pO "
    "; my $cmd = "modify"; my $ncols = $FW_ss ? 30 : 60; - pO ""; - pO "
    " . FW_submit("cmd.${cmd}$name", "$cmd $name"); - pO "
    "; - pO ""; + FW_pO "
    " . FW_submit("cmd.${cmd}$name", "$cmd $name"); + FW_pO "
    "; + FW_pO ""; } sub @@ -1765,16 +1770,16 @@ FW_dumpFileLog($$$) pF "", ($row&1)?"odd":"even"; pF "
    %s
    ", ($nr ? "" : $f); } - pH "cmd=logwrapper $d $lt $f", + FW_pH "cmd=logwrapper $d $lt $f", "
    $name
    ", 1, "dval"; if(!$oneRow) { - pO ""; + FW_pO ""; $row++; } $nr++; } if($oneRow) { - pO ""; + FW_pO ""; $row++; } } diff --git a/webfrontend/pgm2/98_SVG.pm b/webfrontend/pgm2/98_SVG.pm index 89e28f0c4..19faf5162 100755 --- a/webfrontend/pgm2/98_SVG.pm +++ b/webfrontend/pgm2/98_SVG.pm @@ -54,48 +54,48 @@ SVG_render($$$$$$$) my ($w, $h) = ($ow-2*$x, $oh-2*$y); # Rect size # Html Header - pO ''; - pO ''; - pO ''; + FW_pO ''; + FW_pO ''; my $prf = AttrVal($FW_wname, "stylesheetPrefix", ""); - pO ""; + FW_pO "]]>"; if(open(FH, "$FW_dir/${prf}svg_defs.svg") || open(FH, "$FW_dir/svg_defs.svg")) { # gradient definitions - pO join("", ); + FW_pO join("", ); close(FH); } else { Log 0, "Can't open $FW_dir/svg_defs.svg" } # Background - pO ""; + FW_pO ""; # Rectangle - pO ""; my ($off1,$off2) = ($ow/2, 3*$y/4); my $title = ($conf{title} ? $conf{title} : " "); $title =~ s//>/g; - pO "$title"; # Copy and Paste labels, hidden by default - pO " "; - pO " "; @@ -104,13 +104,13 @@ SVG_render($$$$$$$) $t =~ s/"//g; if(!$SVG_ss) { ($off1,$off2) = (3*$th/4, $oh/2); - pO "$t"; $t = ($conf{y2label} ? $conf{y2label} : ""); $t =~ s/"//g; ($off1,$off2) = ($ow-$th/4, $oh/2); - pO "$t"; } @@ -138,7 +138,7 @@ SVG_render($$$$$$$) $desc = sprintf("%s: Min:%g Max:%g Last:%g", $t, $data{"min$j"}, $data{"max$j"}, $data{"currval$j"}); } - pO "$t"; @@ -195,7 +195,7 @@ SVG_render($$$$$$$) $dxp = $hdx[0]; if($dxp && int(@{$dxp}) < 2 && !$tosec) { # not enough data and no range... - pO ""; + FW_pO ""; return; } @@ -238,24 +238,24 @@ SVG_render($$$$$$$) for(my $i = $fromsec+$initoffset; $i < $tosec; $i += $tstep) { $i = time_align($i,$aligntics); $off1 = int($x+($i-$fromsec)*$tmul); - pO ""; - pO ""; + FW_pO ""; + FW_pO ""; } # then the text and the grid $off1 = $x; $off2 = $y+$h+$th; $t = fmtTime($first_tag, $fromsec); - pO "$t"; + FW_pO "$t"; $initoffset = $step; $initoffset = int(($step/2)/86400)*86400 if($aligntext); for(my $i = $fromsec+$initoffset; $i < $tosec; $i += $step) { $i = time_align($i,$aligntext); $off1 = int($x+($i-$fromsec)*$tmul); $t = fmtTime($tag, $i); - pO "$t"; - pO " "; + FW_pO " "; } @@ -313,10 +313,10 @@ SVG_render($$$$$$$) $tlabel =~ s/^"(.*)"$/$1/; $off2 = int($y+($ma-$tvalue)*$hmul); - pO ""; + FW_pO ""; $off2 += $th/4; my $align = ($axis eq "x1y1" ? " text-anchor=\"end\"" : ""); - pO " + FW_pO " $tlabel"; } @@ -324,16 +324,16 @@ SVG_render($$$$$$$) for(my $i = $mi; $i <= $ma; $i += $step) { $off2 = int($y+($ma-$i)*$hmul); - pO " "; + FW_pO " "; if($axis eq "x1y2") { my $o6 = $x+$w; - pO " " + FW_pO " " if($i > $mi && $i < $ma); } $off2 += $th/4; my $align = ($axis eq "x1y1" ? " text-anchor=\"end\"" : ""); my $txt = sprintf("%g", $i); - pO "$txt"; + FW_pO "$txt"; } } @@ -372,7 +372,7 @@ SVG_render($$$$$$$) $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 ""; + FW_pO ""; } } elsif($type[$idx] eq "steps" || $type[$idx] eq "fsteps" ) { @@ -394,7 +394,7 @@ SVG_render($$$$$$$) } } } - pO ""; + FW_pO ""; } elsif($type[$idx] eq "histeps" ) { if(@{$dxp} == 1) { @@ -411,7 +411,7 @@ SVG_render($$$$$$$) $x1,$y1, ($x1+$x2)/2,$y1, ($x1+$x2)/2,$y2, $x2,$y2); } } - pO ""; + FW_pO ""; } else { # lines and everything else foreach my $i (0..int(@{$dxp})-1) { @@ -422,7 +422,7 @@ SVG_render($$$$$$$) $ret .= sprintf(" %d,%d", $x1, $y1); } - pO ""; @@ -430,7 +430,7 @@ SVG_render($$$$$$$) } } - pO ""; + FW_pO ""; } sub diff --git a/webfrontend/pgm2/ks550_all.gplot b/webfrontend/pgm2/ks550_all.gplot new file mode 100644 index 000000000..0e8c3edaa --- /dev/null +++ b/webfrontend/pgm2/ks550_all.gplot @@ -0,0 +1,77 @@ +########################################################################### +### Display values from a KS550. + +# This file is only present for documentation and as a starting point +# for derivation of a subset of measures. Please see and use the other +# ks550_*.gplot files to plot KS550 data. + +### FileLog definition corresponding to this file + +# define FileLog /var/log/fhem/KS550_%Y.log :T:.* + +### FileLog content + +# 2012-01-01_00:00:03 KS550 T: 10.4 H: 97 W: 0 R: 976.45 IR: 0 WD: 40 WDR: 67.5 S: 155 B: 8 + +# This is the status line, which is printed to the logfile. For each of +# the data there is also a separate line available, which you can select +# using a different regular expression in the FileLog define. +# Try .* as an all quantor to see, which lines are available. +# +# Field description: +# 04 T: Temperature +# 06 H: Humidity +# 08 W: Wind velocity +# 10 R: Rain quantity +# 12 IR: Rain indicator +# 14 WD: Direction of wind +# 16 WDR: Range of wind directions (67.5 is the maximum range) +# 18 S: Sunshine duration +# 20 B: Brightness (minimum:8, maximum:255) + +### Settings + +set terminal size +set title '' +set ylabel '' +set y2label '' +set ytics +set y2tics + +# Maybe define your own ranges (not really needed): +#set yrange [1:10] +#set y2range [0:300] + +### Data extraction + +# The following FileLog directives extract the values from the logfile +# lines. If you have only the status lines in the logfile, you do not +# need any regular expression, since the line is valid anyhow. +# +# Some data have default values, others not. Notice also the delta-* +# functions, which are called to compute Rain/h and Rain/d values by +# accumulating the changes as well as the data mapping for the rain +# indicator. + +#FileLog 4::: +#FileLog 6::: +#FileLog 8::: +#FileLog 10::0:delta-h +#FileLog 10::0:delta-d +#FileLog 12::0:$fld[11]=~"32768"?1:0 +#FileLog 14::0: +#FileLog 16::0: +#FileLog 18::0:delta-h +#FileLog 20::0: + +plot \ + title 'T' with lines,\ + title 'H' with lines,\ + title 'W' with lines,\ + title 'R/h' with lines,\ + title 'R/d' with lines,\ + title 'IR' with lines,\ + title 'WD' with lines,\ + title 'WDR' with lines,\ + title 'S' with lines,\ + title 'B' with lines diff --git a/webfrontend/pgm2/ks550_light.gplot b/webfrontend/pgm2/ks550_light.gplot new file mode 100644 index 000000000..2d4dcd697 --- /dev/null +++ b/webfrontend/pgm2/ks550_light.gplot @@ -0,0 +1,67 @@ +########################################################################### +### Display Light and Sunshine values from a KS550 + +# This file uses placeholders. For good results the following +# attribute settings in the WebLink object are recommended: +# +# label: "Luminosity"::"Sunshine duration [h]" +# title: "Light $data{currval1} ($data{min1}-$data{max1}) and Sunshine hours $data{currval2} @ $data{currdate1}" + +### FileLog definition corresponding to this file + +# define FileLog /var/log/fhem/KS550_%Y.log :T:.* + +### FileLog content + +# 2012-01-01_00:00:03 KS550 T: 10.4 H: 97 W: 0 R: 976.45 IR: 0 WD: 40 WDR: 67.5 S: 155 B: 8 + +# This is the status line, which is printed to the logfile. For each of +# the data there is also a separate line available, which you can select +# using a different regular expression in the FileLog define. +# Try .* as an all quantor to see, which lines are available. + +# This is the status line, which is printed to the logfile. For each of +# the data there is also a separate line available, which you can select +# using a different regular expression in the FileLog define. +# Try .* as an all quantor to see, which lines are available. +# +# Field description: +# T: Temperature +# H: Humidity +# W: Wind velocity +# R: Rain quantity +# IR: Rain indicator +# WD: Direction of wind +# WDR: Range of wind directions (67.5 is the maximum range) +# S: Sunshine duration +# B: Brightness (minimum:8, maximum:255) + +### Settings + +set terminal size +set title '' +set ylabel '' +set y2label '' +set ytics +set y2tics + +# Maybe define your own ranges (not really needed): +#set yrange [1:10] +#set y2range [0:300] + +### Data extraction + +# The following FileLog directives extract the values from the logfile +# lines. If you have only the status lines in the logfile, you do not +# need any regular expression, since the line is valid anyhow. +# Notice the delta-* functions, which are called to compute Rain/h and +# Rain/d values by accumulating the changes. + +#FileLog 20::0: +#FileLog 18::0:delta-h + +### Data plotting + +plot \ + axes x1y1 title 'Brightness' with lines,\ + axes x1y2 title 'Sunshine' with lines diff --git a/webfrontend/pgm2/ks550_rain.gplot b/webfrontend/pgm2/ks550_rain.gplot new file mode 100644 index 000000000..c4a2ebf5c --- /dev/null +++ b/webfrontend/pgm2/ks550_rain.gplot @@ -0,0 +1,64 @@ +########################################################################### +### Display Rain values from a KS550 + +# This file uses placeholders. For good results the following +# attribute settings in the WebLink object are recommended: +# +# label: "Rain Volume [l/m2]"::"Rain indicator"::"l/hour"::"l/day"::"Rain?" +# title: "Rain $data{currval2} liters @ $data{currdate1}" + +### FileLog definition corresponding to this file + +# define FileLog /var/log/fhem/KS550_%Y.log :T:.* + +### FileLog content + +# 2012-01-01_00:00:03 KS550 T: 10.4 H: 97 W: 0 R: 976.45 IR: 0 WD: 40 WDR: 67.5 S: 155 B: 8 + +# This is the status line, which is printed to the logfile. For each of +# the data there is also a separate line available, which you can select +# using a different regular expression in the FileLog define. +# Try .* as an all quantor to see, which lines are available. +# +# Field description: +# T: Temperature +# H: Humidity +# W: Wind velocity +# R: Rain quantity +# IR: Rain indicator +# WD: Direction of wind +# WDR: Range of wind directions (67.5 is the maximum range) +# S: Sunshine duration +# B: Brightness (minimum:8, maximum:255) + +### Settings + +set terminal size +set title '' +set ylabel '' +set y2label '' +set ytics +set y2tics + +# Maybe define your own ranges (not really needed): +#set yrange [1:10] +#set y2range [0:300] + +### Data extraction + +# The following FileLog directives extract the values from the logfile +# lines. If you have only the status lines in the logfile, you do not +# need any regular expression, since the line is valid anyhow. +# Notice the delta-* functions, which are called to compute Rain/h and +# Rain/d values by accumulating the changes and the value remapping. + +#FileLog 10::0:delta-h +#FileLog 10::0:delta-d +#FileLog 12::0:$fld[11]=~"32768"?0.8:0 + +### Data plotting + +plot \ + axes x1y1 title '' with steps lw 2,\ + axes x1y1 title '' with steps,\ + axes x1y2 title '' with steps diff --git a/webfrontend/pgm2/ks550_th.gplot b/webfrontend/pgm2/ks550_th.gplot new file mode 100644 index 000000000..468965d8d --- /dev/null +++ b/webfrontend/pgm2/ks550_th.gplot @@ -0,0 +1,61 @@ +########################################################################### +### Display Temperature/Humidity values from a KS550 + +# This file uses placeholders. For good results the following +# attribute settings in the WebLink object are recommended: +# +# label: "Rel. Humidity [%]"::"Temperature [C]"::"Temperature"::"rel. Humidity" +# title: "Temperature $data{currval1} ($data{min1}-$data{max1}), Humidity $data{currval2} ($data{min2}-$data{max2}) @ $data{currdate1}" + +### FileLog definition corresponding to this file + +# define FileLog /var/log/fhem/KS550_%Y.log :T:.* + +### FileLog content + +# 2012-01-01_00:00:03 KS550 T: 10.4 H: 97 W: 0 R: 976.45 IR: 0 WD: 40 WDR: 67.5 S: 155 B: 8 + +# This is the status line, which is printed to the logfile. For each of +# the data there is also a separate line available, which you can select +# using a different regular expression in the FileLog define. +# Try .* as an all quantor to see, which lines are available. +# +# Field description: +# T: Temperature +# H: Humidity +# W: Wind velocity +# R: Rain quantity +# IR: Rain indicator +# WD: Direction of wind +# WDR: Range of wind directions (67.5 is the maximum range) +# S: Sunshine duration +# B: Brightness (minimum:8, maximum:255) + +### Settings + +set terminal size +set title '' +set ylabel '' +set y2label '' +set ytics +set y2tics + +# Maybe define your own ranges (not really needed): +#set yrange [1:10] +#set y2range [0:300] + +### Data extraction + +# The following FileLog directives extract the values from the logfile +# lines. If you have only the status lines in the logfile, you do not +# need any regular expression, since the line is valid anyhow. No +# defaults are used here either. + +#FileLog 4::: +#FileLog 6::: + +### Data plotting + +plot \ + axes x1y2 title '' with lines,\ + axes x1y1 title '' with lines diff --git a/webfrontend/pgm2/ks550_wind.gplot b/webfrontend/pgm2/ks550_wind.gplot new file mode 100644 index 000000000..cd9bf742a --- /dev/null +++ b/webfrontend/pgm2/ks550_wind.gplot @@ -0,0 +1,63 @@ +########################################################################### +### Display Wind values from a KS550 + +# This file uses placeholders. For good results the following +# attribute settings in the WebLink object are recommended: +# +# label: "Wind Speed [km/h]"::"Direction [360]"::"Speed"::"Direction"::"Range (max. 67.5)" +# title: "Wind $data{currval1} ($data{min1}-$data{max1}), Direction $data{currval2} ($data{min2}-$data{max2}) and Range $data{currval3} @ $data{currdate1}" + +### FileLog definition corresponding to this file + +# define FileLog /var/log/fhem/KS550_%Y.log :T:.* + +### FileLog content + +# 2012-01-01_00:00:03 KS550 T: 10.4 H: 97 W: 0 R: 976.45 IR: 0 WD: 40 WDR: 67.5 S: 155 B: 8 + +# This is the status line, which is printed to the logfile. For each of +# the data there is also a separate line available, which you can select +# using a different regular expression in the FileLog define. +# Try .* as an all quantor to see, which lines are available. +# +# Field description: +# T: Temperature +# H: Humidity +# W: Wind velocity +# R: Rain quantity +# IR: Rain indicator +# WD: Direction of wind +# WDR: Range of wind directions (67.5 is the maximum range) +# S: Sunshine duration +# B: Brightness (minimum:8, maximum:255) + +### Settings + +set terminal size +set title '' +set ylabel '' +set y2label '' +set ytics +set y2tics + +# Maybe define your own ranges (not really needed): +#set yrange [1:10] +#set y2range [0:300] + +### Data extraction + +# The following FileLog directives extract the values from the logfile +# lines. If you have only the status lines in the logfile, you do not +# need any regular expression, since the line is valid anyhow. +# Notice the use ans non-use of default values + +#FileLog 8::0: +#FileLog 14::: +#FileLog 16::: + +### Data plotting + +plot \ + axes x1y1 title '' with lines,\ + axes x1y2 title '' with steps,\ + axes x1y2 title '' with steps diff --git a/webfrontend/pgm2/longpoll.js b/webfrontend/pgm2/longpoll.js index 6c998048c..4f96c452e 100644 --- a/webfrontend/pgm2/longpoll.js +++ b/webfrontend/pgm2/longpoll.js @@ -42,4 +42,10 @@ longpoll() pollConn.send(null); } -window.onload = longpoll; +function +delayedStart() +{ + setTimeout("longpoll()", 1000); +} + +window.onload = delayedStart;