mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
98_MSwitch.pm:fix incorrect execution of cmd with defined id
git-svn-id: https://svn.fhem.de/fhem/trunk@18204 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
521f3d801c
commit
cb6c82c55c
@ -824,7 +824,7 @@ sub MSwitch_Get($$@) {
|
|||||||
$ret .=
|
$ret .=
|
||||||
"<div nowrap>"
|
"<div nowrap>"
|
||||||
. $time
|
. $time
|
||||||
. " execute 'cmd1+cmd2' commands from ID "
|
. " execute 'cmd1+cmd2' commands with ID "
|
||||||
. $id
|
. $id
|
||||||
. " only</div>";
|
. " only</div>";
|
||||||
}
|
}
|
||||||
@ -840,7 +840,7 @@ sub MSwitch_Get($$@) {
|
|||||||
$ret .=
|
$ret .=
|
||||||
"<div nowrap>"
|
"<div nowrap>"
|
||||||
. $time
|
. $time
|
||||||
. " execute 'cmd1' commands from ID "
|
. " execute 'cmd1' commands with ID "
|
||||||
. $id
|
. $id
|
||||||
. " only</div>";
|
. " only</div>";
|
||||||
}
|
}
|
||||||
@ -6044,9 +6044,17 @@ sub MSwitch_Exec_Notif($$$$$) {
|
|||||||
MSwitch_LOG( $name, 6,
|
MSwitch_LOG( $name, 6,
|
||||||
"$name: zu schaltende devices -> " . @devices . " @devices" );
|
"$name: zu schaltende devices -> " . @devices . " @devices" );
|
||||||
|
|
||||||
|
|
||||||
|
#Log3( $name, 0, "devices 1: ".@devices." @devices" );
|
||||||
|
|
||||||
# liste nach priorität ändern , falls expert
|
# liste nach priorität ändern , falls expert
|
||||||
@devices = MSwitch_priority( $hash, $execids, @devices );
|
@devices = MSwitch_priority( $hash, $execids, @devices );
|
||||||
|
|
||||||
|
|
||||||
|
#Log3( $name, 0, "devices 2: ".@devices." @devices" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my $lastdevice;
|
my $lastdevice;
|
||||||
|
|
||||||
LOOP45: foreach my $device (@devices) {
|
LOOP45: foreach my $device (@devices) {
|
||||||
@ -7292,10 +7300,22 @@ m/(.*?)([0-9]{2}):([0-9]{2})\*([0-9]{2}:[0-9]{2})-([0-9]{2}:[0-9]{2})\|?([0-9]{0
|
|||||||
LOOP3: foreach my $option1 (@optionarray) {
|
LOOP3: foreach my $option1 (@optionarray) {
|
||||||
$id = "";
|
$id = "";
|
||||||
|
|
||||||
|
|
||||||
|
#Log3( $Name, 0, "option: $option1" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( $option1 =~ m/(.*)\|(ID.*)$/ ) {
|
if ( $option1 =~ m/(.*)\|(ID.*)$/ ) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$id = $2;
|
$id = $2;
|
||||||
|
|
||||||
$option1 = $1;
|
$option1 = $1;
|
||||||
|
#Log3( $Name, 0, "id: $id" );
|
||||||
|
#Log3( $Name, 0, "option1: $option1" );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $option1 =~
|
if ( $option1 =~
|
||||||
@ -7348,15 +7368,30 @@ m/(.*?)([0-9]{2}):([0-9]{2})\*([0-9]{2}:[0-9]{2})-([0-9]{2}:[0-9]{2})\|?([0-9]{0
|
|||||||
if ( $timecond > $jetzt ) {
|
if ( $timecond > $jetzt ) {
|
||||||
|
|
||||||
my $number = $i;
|
my $number = $i;
|
||||||
if ( $id ne "" && $i == 3 || $i == 4 ) {
|
|
||||||
|
#Log3( $Name, 0, "i: $i" );
|
||||||
|
|
||||||
|
|
||||||
|
if ( $id ne "" && ($i == 3 || $i == 4 ))
|
||||||
|
{
|
||||||
$number = $number + 3;
|
$number = $number + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $i == 5 ) { $number = 9; }
|
if ( $i == 5 ) { $number = 9; }
|
||||||
|
|
||||||
if ( $id ne "" && $number == 9 ) { $number = 10; }
|
if ( $id ne "" && $number == 9 ) { $number = 10; }
|
||||||
|
|
||||||
my $inhalt = $timecond . "-" . $number . $id;
|
my $inhalt = $timecond . "-" . $number . $id;
|
||||||
$hash->{helper}{timer}{$inhalt} = "$inhalt";
|
$hash->{helper}{timer}{$inhalt} = "$inhalt";
|
||||||
my $msg = $Name . " " . $timecond . " " . $number . $id;
|
my $msg = $Name . " " . $timecond . " " . $number . $id;
|
||||||
|
|
||||||
|
#Log3( $Name, 0, "number: $number" );
|
||||||
|
#Log3( $Name, 0, "id: $id" );
|
||||||
|
|
||||||
|
#Log3( $Name, 0, "msg: $msg" );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InternalTimer( $timecond, "MSwitch_Execute_Timer", $msg );
|
InternalTimer( $timecond, "MSwitch_Execute_Timer", $msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7509,6 +7544,8 @@ sub MSwitch_Execute_Timer($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $param eq '6' ) {
|
if ( $param eq '6' ) {
|
||||||
|
|
||||||
|
|
||||||
MSwitch_Exec_Notif( $hash, 'on', 'nocheck', '', $execid );
|
MSwitch_Exec_Notif( $hash, 'on', 'nocheck', '', $execid );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8629,17 +8666,22 @@ sub MSwitch_priority(@) {
|
|||||||
|
|
||||||
# $execids beinhaltet auszuführende ids gesetzt bei init
|
# $execids beinhaltet auszuführende ids gesetzt bei init
|
||||||
my $key1 = $device . "_id";
|
my $key1 = $device . "_id";
|
||||||
MSwitch_LOG( $name, 6,
|
MSwitch_LOG( $name, 6, "$name: device hat die ID $device - $devicedetails{$key1}" );
|
||||||
"$name: device hat die ID $device - $devicedetails{$key1}" );
|
|
||||||
|
|
||||||
MSwitch_LOG( $name, 6, "$name: zulässige IDS - @execids " );
|
MSwitch_LOG( $name, 6, "$name: zulaessige IDS - @execids " );
|
||||||
|
|
||||||
next if !( grep { $_ eq $devicedetails{$key1} } @execids );
|
if (! grep { $_ eq $devicedetails{$key1} } @execids )
|
||||||
|
{
|
||||||
|
MSwitch_LOG( $name, 6, "$name: abbruch -> unzulaessige ID " );
|
||||||
|
next;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
my $key = $device . "_priority";
|
my $key = $device . "_priority";
|
||||||
my $prio = $devicedetails{$key};
|
my $prio = $devicedetails{$key};
|
||||||
MSwitch_LOG( $name, 6,
|
|
||||||
"$name: device hat die priority $device - $prio" );
|
MSwitch_LOG( $name, 6, "$name: device hat die priority $device - $prio" );
|
||||||
|
|
||||||
$new{$device} = $prio;
|
$new{$device} = $prio;
|
||||||
|
|
||||||
$hash->{helper}{priorityids}{$device} = $prio;
|
$hash->{helper}{priorityids}{$device} = $prio;
|
||||||
@ -8658,6 +8700,8 @@ sub MSwitch_priority(@) {
|
|||||||
my $anzahl = @newlist;
|
my $anzahl = @newlist;
|
||||||
MSwitch_LOG( $name, 5, "$name: anzahl $anzahl" );
|
MSwitch_LOG( $name, 5, "$name: anzahl $anzahl" );
|
||||||
@devices = @newlist if $anzahl > 0;
|
@devices = @newlist if $anzahl > 0;
|
||||||
|
@devices = () if $anzahl == 0;
|
||||||
|
|
||||||
|
|
||||||
return @devices;
|
return @devices;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user