mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
Added FS20S8, removed stty_parmrk (Debian does not have it), FileLog Archiving continued.
git-svn-id: https://svn.fhem.de/fhem/trunk@62 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7ef4852fa0
commit
443f0de25f
@ -330,3 +330,4 @@
|
||||
- feature: The "-" in the name is not allowed any more
|
||||
- bugfix: disabled notify causes "uninitialized value" (STefan, 1.5)
|
||||
- bugfix: deleted FS20 items are still logging (zombie) (Gerhard, 16.5)
|
||||
- bugfix: added FS20S8, removed stty_parmrk (Martin, 24.5)
|
||||
|
@ -227,7 +227,7 @@ FHZ_Define($$)
|
||||
# settings. Device::SerialPort is nice: if the flag is not defined for your
|
||||
# OS then it will be ignored.
|
||||
$po->stty_icanon(0);
|
||||
$po->stty_parmrk(0);
|
||||
#$po->stty_parmrk(0); # The debian standard install does not have it
|
||||
$po->stty_icrnl(0);
|
||||
$po->stty_echoe(0);
|
||||
$po->stty_echok(0);
|
||||
|
@ -100,7 +100,7 @@ FS20_Initialize($)
|
||||
$hash->{DefFn} = "FS20_Define";
|
||||
$hash->{UndefFn} = "FS20_Undef";
|
||||
$hash->{ParseFn} = "FS20_Parse";
|
||||
$hash->{AttrList} = "follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6";
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,8 @@ FileLog_Initialize($)
|
||||
$hash->{UndefFn} = "FileLog_Undef";
|
||||
$hash->{NotifyFn} = "FileLog_Log";
|
||||
$hash->{AttrFn} = "FileLog_Attr";
|
||||
$hash->{AttrList} = "disable:0,1 logtype nrarchive archivedir";
|
||||
# logtype is used by the frontend
|
||||
$hash->{AttrList} = "disable:0,1 logtype nrarchive archivedir archivecmd";
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +60,47 @@ sub
|
||||
HandleArchiving($)
|
||||
{
|
||||
my ($log) = @_;
|
||||
my $ln = $log->{NAME};
|
||||
return if(!$attr{$ln});
|
||||
|
||||
# If there is a command, call that
|
||||
my $cmd = $attr{$ln}{archivecmd};
|
||||
if($cmd) {
|
||||
$cmd =~ s/%/$log->{CURRENT}/g;
|
||||
Log 2, "Archive: calling $cmd";
|
||||
system($cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
my $nra = $attr{$ln}{nrarchive};
|
||||
my $ard = $attr{$ln}{archivedir};
|
||||
return if(!defined($nra));
|
||||
|
||||
# If nrarchive is set, then check the last files:
|
||||
# Get a list of files:
|
||||
|
||||
my ($dir, $file);
|
||||
if($log->{FILENAME} =~ m,^(.+)/([^/]+)$,) {
|
||||
($dir, $file) = ($1, $2);
|
||||
} else {
|
||||
($dir, $file) = (".", $log->{FILENAME});
|
||||
}
|
||||
|
||||
$file =~ s/%./.+/g;
|
||||
return if(!opendir(DH, $dir));
|
||||
my @files = sort grep {/^$file$/} readdir(DH);
|
||||
closedir(DH);
|
||||
|
||||
my $max = int(@files)-$nra;
|
||||
for(my $i = 0; $i < $max; $i++) {
|
||||
if($ard) {
|
||||
Log 2, "Moving $files[$i] to $ard";
|
||||
rename("$dir/$files[$i]", "$ard/$files[$i]");
|
||||
} else {
|
||||
Log 2, "Deleting $files[$i]";
|
||||
unlink("$dir/$files[$i]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#####################################
|
||||
@ -74,11 +116,12 @@ FileLog_Log($$)
|
||||
my $n = $dev->{NAME};
|
||||
my $re = $log->{REGEXP};
|
||||
my $max = int(@{$dev->{CHANGED}});
|
||||
|
||||
for (my $i = 0; $i < $max; $i++) {
|
||||
my $s = $dev->{CHANGED}[$i];
|
||||
Log 1, "FL: Checking $n:$s against $re";
|
||||
$s = "" if(!defined($s));
|
||||
if($n =~ m/^$re$/ || "$n:$s" =~ m/^$re$/) {
|
||||
Log 1, "FL: Logging";
|
||||
my $t = TimeNow();
|
||||
$t = $dev->{CHANGETIME}[$i] if(defined($dev->{CHANGETIME}[$i]));
|
||||
$t =~ s/ /_/; # Makes it easier to parse with gnuplot
|
||||
@ -88,8 +131,8 @@ FileLog_Log($$)
|
||||
my $cn = ResolveDateWildcards($log->{FILENAME}, @t);
|
||||
|
||||
if($cn ne $log->{CURRENT}) { # New logfile
|
||||
HandleArchiving($log);
|
||||
$fh->close();
|
||||
HandleArchiving($log);
|
||||
$fh = new IO::File ">>$cn";
|
||||
if(!defined($fh)) {
|
||||
Log(0, "Can't open $cn");
|
||||
|
@ -144,8 +144,11 @@ split in multiple lines<br><br>
|
||||
If this attribute is set, then the last command of the generated
|
||||
configfile (see the <a href="#save">save</a> command) will be<br>
|
||||
include <lastinclude-value><br>
|
||||
This file can contain not configurable information, e.g.
|
||||
setting the FHTcode.
|
||||
This file is needed, as the save command will write only defines and
|
||||
attributes to the config file, any other commands / includes will be
|
||||
lost. E.g. it makes sense to set the <a href="FHZset">FHTcode</a> in
|
||||
this file or the coordinates of your house via
|
||||
<a href="#at">sunrise_coord</at>
|
||||
</li><br>
|
||||
|
||||
<a name="logfile"></a>
|
||||
@ -354,6 +357,7 @@ split in multiple lines<br><br>
|
||||
fs20pira
|
||||
fs20piri
|
||||
fs20s20
|
||||
fs20s8
|
||||
fs20s4
|
||||
fs20s4a
|
||||
fs20s4m
|
||||
@ -1054,7 +1058,13 @@ split in multiple lines<br><br>
|
||||
<br><br>
|
||||
Save first the <a href="#statefile">statefile</a>, then the
|
||||
<a href="#configfile">configfile</a> information. If a parameter is specified,
|
||||
it will be used instead the global configfile attribute.<br>
|
||||
it will be used instead the global configfile attribute.<br><br>
|
||||
Notes:
|
||||
<ul>
|
||||
<li>save only writes out definitions and attributes, but no commands
|
||||
which were previously part of the config file. Put such commands in the
|
||||
<a href="#lastinclude">lastinclude</a> file.
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@ start</b>
|
||||
<ul>
|
||||
If you already programmed some devices, then just start fhem.pl with one
|
||||
of the example configuration files, and watch the log. When activating a
|
||||
deivce (e.g. with the remote) then it will be logged as an unknown device
|
||||
device (e.g. with the remote) then it will be logged as an unknown device
|
||||
with the housecode. Note: the verbose level must be 3 or higher. KS300
|
||||
devices do not have a proper code, so you can use anything.
|
||||
</ul>
|
||||
@ -251,7 +251,17 @@ by fhem.pl?</b>
|
||||
restart the program. If everything is ok, typing
|
||||
<pre>{ sunrise_abs() }</pre>
|
||||
in the telnet prompt, will return the time of the sunrise today, in a
|
||||
HH:MM:SS format.
|
||||
HH:MM:SS format.<br><br>
|
||||
|
||||
<b>Note:</b> As fhem.cfg will be overwritten if you use the save command,
|
||||
it is better to put the sunrise_coord command in the "lastinclude" file,
|
||||
e.g. /home/fhem/fhem.cfg.static. This file will be read, if you set the
|
||||
lastinclude attribute:<br><code><br>
|
||||
|
||||
attr global lastinclude /home/fhem/fhem.cfg.static</code><br><br>
|
||||
|
||||
and will not be overwritten by save.
|
||||
|
||||
</ul>
|
||||
|
||||
<a name="faq12"></a>
|
||||
|
@ -1,5 +1,8 @@
|
||||
On the telnet prompt do:
|
||||
{FhzDecode("<code>")}
|
||||
{FS20_Parse(undef, "<code>");}
|
||||
e.g.
|
||||
{FS20_Parse(undef, "81xx04xx0101a0011234030011")}
|
||||
|
||||
where <code> is one of:
|
||||
|
||||
81xx04xx0101a0011234030011 FS20 dev: 1234 button: 03 on (11)
|
||||
|
@ -1,10 +1,10 @@
|
||||
#Tue May 1 17:03:03 2007
|
||||
#Sat May 19 18:46:13 2007
|
||||
setstate FHZ fhtbuf: 1c
|
||||
setstate FHZ 2006-02-12 14:03:39 fhtbuf 23
|
||||
setstate FHZ 2006-03-26 08:47:36 init2 deadbeefdeadbe
|
||||
setstate FHZ 2006-03-26 08:47:36 serial deadbeef
|
||||
setstate btn4 on
|
||||
setstate btn4 2006-04-12 15:19:33 state on
|
||||
setstate btn4 2007-05-17 16:58:46 state on
|
||||
setstate cellar on-for-timer 2
|
||||
setstate cellar 2007-04-22 14:04:12 state on-for-timer 2
|
||||
setstate fl measured-temp: 21.6 (Celsius)
|
||||
|
Loading…
Reference in New Issue
Block a user