Bugfixes.

git-svn-id: https://svn.fhem.de/fhem/trunk@37 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2007-03-28 17:26:27 +00:00
parent 15a62576d2
commit 795c4be1b7
5 changed files with 32 additions and 10 deletions

View File

@@ -89,7 +89,7 @@ FHZ_Set($@)
my $v = join(" ", @a); my $v = join(" ", @a);
my $name = $hash->{NAME}; my $name = $hash->{NAME};
Log GetLogLevel($name,2), "FHZ set $name $v"; Log GetLogLevel($name,2), "FHZ set $v";
if($a[1] eq "activefor") { if($a[1] eq "activefor") {

View File

@@ -23,7 +23,7 @@ sub
notify_Define($$) notify_Define($$)
{ {
my ($hash, $def) = @_; my ($hash, $def) = @_;
my ($re, $command) = split("[ \t]+", $def, 2); my ($type, $name, $re, $command) = split("[ \t]+", $def, 4);
# Checking for misleading regexps # Checking for misleading regexps
eval { "Hallo" =~ m/^$re$/ }; eval { "Hallo" =~ m/^$re$/ };

View File

@@ -113,6 +113,15 @@ split in multiple lines<br><br>
be written to this file. be written to this file.
</li><br> </li><br>
<a name="lastinclude"></a>
<li>lastinclude<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 &lt;lastinclude-value&gt;<br>
This file can contain not configurable information, e.g.
setting the FHTcode.
</li><br>
<a name="logfile"></a> <a name="logfile"></a>
<li>logfile<br> <li>logfile<br>
Specify the logfile to write. You can use "-" for Specify the logfile to write. You can use "-" for

View File

@@ -9,7 +9,9 @@
<body style="background-color: white"> <body style="background-color: white">
<h1>FHEM (GPL'd FS20/HMS/FHT/KS300/WS300 server for linux, formerly known as fhz1000.pl)</h1> <h1>FHEM</h1>
GPL'd FHZ FS20 HMS FHT KS300 WS300 server for linux, formerly known as
fhz1000.pl
<h2>News (as of =DATE=, Version =VERS=)</h2> <h2>News (as of =DATE=, Version =VERS=)</h2>
<ul> <ul>

View File

@@ -136,7 +136,7 @@ my $AttrList = "room";
$modules{_internal_}{ORDER} = -1; $modules{_internal_}{ORDER} = -1;
$modules{_internal_}{AttrList} = "configfile logfile modpath " . $modules{_internal_}{AttrList} = "configfile logfile lastinclude modpath " .
"pidfilename port statefile title userattr " . "pidfilename port statefile title userattr " .
"verbose:1,2,3,4,5 version"; "verbose:1,2,3,4,5 version";
@@ -535,13 +535,14 @@ sub
CommandInclude($$) CommandInclude($$)
{ {
my ($cl, $arg) = @_; my ($cl, $arg) = @_;
if(!open(CFG, $arg)) { my $fh;
if(!open($fh, $arg)) {
return "Can't open $arg: $!"; return "Can't open $arg: $!";
} }
my $bigcmd = ""; my $bigcmd = "";
$rcvdquit = 0; $rcvdquit = 0;
while(my $l = <CFG>) { while(my $l = <$fh>) {
chomp($l); chomp($l);
if($l =~ m/^(.*)\\$/) { # Multiline commands if($l =~ m/^(.*)\\$/) { # Multiline commands
$bigcmd .= $1; $bigcmd .= $1;
@@ -551,7 +552,7 @@ CommandInclude($$)
} }
last if($rcvdquit); last if($rcvdquit);
} }
close(CFG); close($fh);
return undef; return undef;
} }
@@ -706,8 +707,10 @@ CommandSave($$)
foreach my $d (sort keys %savefirst) { foreach my $d (sort keys %savefirst) {
my $r = $savefirst{$d}; my $r = $savefirst{$d};
delete $rooms{$r}{$d}; delete $rooms{$r}{$d};
delete $rooms{$r} if(int(%{$rooms{$r}}) == 0); delete $rooms{$r} if(! %{$rooms{$r}});
print SFH "define $d $defs{$d}{TYPE} $defs{$d}{DEF}\n"; my $def = $defs{$d}{DEF};
$def =~ s/;/;;/g;
print SFH "define $d $defs{$d}{TYPE} $def\n";
foreach my $a (sort keys %{$attr{$d}}) { foreach my $a (sort keys %{$attr{$d}}) {
next if($a eq "savefirst"); next if($a eq "savefirst");
print SFH "attr $d $a $attr{$d}{$a}\n"; print SFH "attr $d $a $attr{$d}{$a}\n";
@@ -718,13 +721,21 @@ CommandSave($$)
print SFH "\ndefattr" . ($r ne "~" ? " room $r" : "") . "\n"; print SFH "\ndefattr" . ($r ne "~" ? " room $r" : "") . "\n";
foreach my $d (sort keys %{$rooms{$r}} ) { foreach my $d (sort keys %{$rooms{$r}} ) {
next if($defs{$d}{VOLATILE}); next if($defs{$d}{VOLATILE});
print SFH "define $d $defs{$d}{TYPE} $defs{$d}{DEF}\n"; my $def = $defs{$d}{DEF};
$def =~ s/;/;;/g;
print SFH "define $d $defs{$d}{TYPE} $def\n";
foreach my $a (sort keys %{$attr{$d}}) { foreach my $a (sort keys %{$attr{$d}}) {
next if($a eq "room"); next if($a eq "room");
print SFH "attr $d $a $attr{$d}{$a}\n"; print SFH "attr $d $a $attr{$d}{$a}\n";
} }
} }
} }
print SFH "defattr\n"; # Delete the last default attribute.
print SFH "include $attr{global}{lastinclude}\n"
if($attr{global}{lastinclude});
close(SFH); close(SFH);
return undef; return undef;