mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
98_DOIF.pm new option: init_-block
git-svn-id: https://svn.fhem.de/fhem/trunk@25663 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
62577537fa
commit
f386a73267
@ -2830,13 +2830,15 @@ DOIF_Notify($$)
|
|||||||
readingsEndUpdate($hash, 0);
|
readingsEndUpdate($hash, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined $hash->{perlblock}{init}) {
|
for (my $i=0; $i < keys %{$hash->{perlblock}};$i++) {
|
||||||
if (($ret,$err)=DOIF_CheckCond($hash,$hash->{perlblock}{init})) {
|
if ($hash->{perlblock}{$i} eq "init" or $hash->{perlblock}{$i} =~ "^init_" ) {
|
||||||
if ($err) {
|
if (($ret,$err)=DOIF_CheckCond($hash,$i)) {
|
||||||
Log3 $hash->{NAME},4,"$hash->{NAME}: $err in perl block init" if ($ret != -1);
|
if ($err) {
|
||||||
readingsSingleUpdate ($hash, "block_init", $err,0);
|
Log3 $hash->{NAME},4,"$hash->{NAME}: $err in perl block $hash->{perlblock}{$i}" if ($ret != -1);
|
||||||
} else {
|
readingsSingleUpdate ($hash, "block_$hash->{perlblock}{$i}", $err,0);
|
||||||
readingsSingleUpdate ($hash, "block_init", "executed",0);
|
} else {
|
||||||
|
readingsSingleUpdate ($hash, "block_$hash->{perlblock}{$i}", "executed",0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3452,9 +3454,9 @@ sub DOIF_Perlblock
|
|||||||
return ($perlblock,$err) if ($err);
|
return ($perlblock,$err) if ($err);
|
||||||
$hash->{condition}{$i}=$perlblock;
|
$hash->{condition}{$i}=$perlblock;
|
||||||
$hash->{perlblock}{$i}=$blockname ? $blockname:sprintf("block_%02d",($i+1));
|
$hash->{perlblock}{$i}=$blockname ? $blockname:sprintf("block_%02d",($i+1));
|
||||||
if ($blockname eq "init") {
|
#if ($blockname eq "init") {
|
||||||
$hash->{perlblock}{init}=$i;
|
# $hash->{perlblock}{init}=$i;
|
||||||
}
|
#}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3555,14 +3557,16 @@ CmdDoIfPerl($$)
|
|||||||
# }
|
# }
|
||||||
# $i++;
|
# $i++;
|
||||||
# }
|
# }
|
||||||
if (defined $hash->{perlblock}{init}) {
|
if ($init_done) {
|
||||||
if ($init_done) {
|
for (my $i=0; $i < keys %{$hash->{perlblock}};$i++) {
|
||||||
if (($ret,$err)=DOIF_CheckCond($hash,$hash->{perlblock}{init})) {
|
if ($hash->{perlblock}{$i} eq "init" or $hash->{perlblock}{$i} =~ "^init_" ) {
|
||||||
if ($err) {
|
if (($ret,$err)=DOIF_CheckCond($hash,$i)) {
|
||||||
Log3 $hash->{NAME},4,"$hash->{NAME}: $err in perl block init" if ($ret != -1);
|
if ($err) {
|
||||||
readingsSingleUpdate ($hash, "block_init", $err,0);
|
Log3 $hash->{NAME},4,"$hash->{NAME}: $err in perl block $hash->{perlblock}{$i}" if ($ret != -1);
|
||||||
} else {
|
readingsSingleUpdate ($hash, "block_$hash->{perlblock}{$i}", $err,0);
|
||||||
readingsSingleUpdate ($hash, "block_init", "executed",0);
|
} else {
|
||||||
|
readingsSingleUpdate ($hash, "block_$hash->{perlblock}{$i}", "executed",0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user