From 5298d8c1f94e3caad3771a755a1eb54b0e3cf3b1 Mon Sep 17 00:00:00 2001 From: Byte09 <> Date: Fri, 2 Nov 2018 05:06:07 +0000 Subject: [PATCH] 98_MSwitch.pm:fix view timer / change create timer git-svn-id: https://svn.fhem.de/fhem/trunk@17659 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_MSwitch.pm | 60 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/98_MSwitch.pm b/fhem/FHEM/98_MSwitch.pm index b4b0fa53f..2455a3928 100644 --- a/fhem/FHEM/98_MSwitch.pm +++ b/fhem/FHEM/98_MSwitch.pm @@ -405,6 +405,9 @@ sub MSwitch_summary($) { \$( \".devType\" ).text( \"MSwitch Inforoom: Anzeige der Deviceinformationen, Änderungen sind nur in den Details möglich.\" ); }); "; + + $ret =~ s/#dp /:/g; + return $ret; } @@ -2048,6 +2051,10 @@ sub MSwitch_Notify($$) { delete( $own_hash->{READINGS}{waiting} ); } + + MSwitch_LOG( $ownName, 6, "-------------waiting passiert-----------------" ); + + my $incommingdevice = ''; if ( defined( $own_hash->{helper}{testevent_device} ) ) { @@ -5954,6 +5961,40 @@ sub MSwitch_checkcondition($$$) { if ( !defined($condition) ) { return 'true'; } if ( $condition eq '' ) { return 'true'; } + + + + ###### perlersetzung + ############## + + # my $x = 0; + # while ( $condition =~ m/(.*?){(.*)}(.*)?/ ) { + # my $firstpart = $1; + # my $secondpart = $2; + # my $lastpart = $3; + # $condition = $firstpart . "test" . $lastpart; + # $x++; + # last if $x > 10; #notausstieg + # } + ##################################### + + + + + + + + + + + + + + + + + + if ( AttrVal( $name, 'MSwitch_RandomNumber', '' ) ne '' ) { MSwitch_Createnumber($hash); } @@ -6379,17 +6420,24 @@ sub MSwitch_Createtimer($) { $key = 'ly'; $condition =~ s/$key//ig; - $x = 0; - + $x = 0; # achtung perl 5.30 - while ( $condition =~ m/(.*).\{(.*)\}.(.*)/ ) { + while ( $condition =~ m/(.*)\{(.*)\}(.*)/ ) { $x++; # notausstieg last if $x > 20; # notausstieg if ( defined $2 ) { - my $part2 = "[" . substr( ( eval $2 ), 0, 5 ) . "]"; - my $test = substr( ( eval $2 ), 0, 2 ) * 1; + my $part1 = $1; + my $part3 = $3; + my $part2 = eval $2 ; + if ($part2 !~ m/^[0-9]{2}:[0-9]{2}$|^[0-9]{2}:[0-9]{2}:[0-9]{2}$/) + { + MSwitch_LOG( $Name, 1, "$Name: ERROR wrong format in set timer. There are no timers running. Format must be HH:MM. Format is: $part2 " ); + return; + } + $part2 = substr( $part2, 0, 5 ); + my $test = substr( $part2, 0, 2 ) * 1; $part2 = "" if $test > 23; - $condition = $1 . $part2 . $3; + $condition = $part1 . $part2 . $part3; } }