98_MSwitch.pm:add accept commentlines at freecmds (#comment)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@17232 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Byte09 2018-08-30 15:10:48 +00:00
parent b3b5f2a16a
commit bb28023fb7

View File

@ -601,6 +601,8 @@ sub MSwitch_Get($$@) {
################################################# #################################################
if ( $opt eq 'active_timer' && $args[0] eq 'show' ) if ( $opt eq 'active_timer' && $args[0] eq 'show' )
{ {
$ret .= "<div nowrap>Systemzeit: ".localtime()."</div><hr>";
$ret .= "<div nowrap>Schaltzeiten (at - kommandos).</div><hr>"; $ret .= "<div nowrap>Schaltzeiten (at - kommandos).</div><hr>";
#timer #timer
my $timehash = $hash->{helper}{timer}; my $timehash = $hash->{helper}{timer};
@ -1183,8 +1185,18 @@ sub MSwitch_Set($@) {
$cs = "$devicedetails{$device.'_onarg'}"; $cs = "$devicedetails{$device.'_onarg'}";
# setmagic # setmagic
$cs =~ s/\n//g;
#Log3( $name, 0,"$name MSwitch_Set: ".$cs." L:". __LINE__ );
$cs =~ s/#\[ti\]/~/g; $cs =~ s/#\[ti\]/~/g;
# entferne kommntarzeilen
$cs =~ s/#.*\n//g;
$cs =~ s/\n//g;
my $x =0; my $x =0;
while ( $cs =~ m/(.*)\[(.*)\:(.*)\](.*)/ ) while ( $cs =~ m/(.*)\[(.*)\:(.*)\](.*)/ )
{ {
@ -1341,8 +1353,14 @@ sub MSwitch_Set($@) {
{ {
$cs = "$devicedetails{$device.'_offarg'}"; $cs = "$devicedetails{$device.'_offarg'}";
# setmagic # setmagic
$cs =~ s/\n//g;
$cs =~ s/#\[ti\]/~/g; $cs =~ s/#\[ti\]/~/g;
# entferne kommntarzeilen
$cs =~ s/#.*\n//g;
$cs =~ s/\n//g;
my $x =0; my $x =0;
while ( $cs =~ m/(.*)\[(.*)\:(.*)\](.*)/ ) while ( $cs =~ m/(.*)\[(.*)\:(.*)\](.*)/ )
{ {
@ -1494,6 +1512,15 @@ sub MSwitch_Cmd(@) {
############################ ############################
if ( $cmds =~ m/{.*}/ ) if ( $cmds =~ m/{.*}/ )
{ {
#Log3( $Name, 0,"$Name MSwitch_Cmd: ".$cmds." " . __LINE__ );
eval($cmds); eval($cmds);
if ($@) if ($@)
{ {
@ -4360,8 +4387,15 @@ sub MSwitch_Exec_Notif($$$$) {
# setmagic # setmagic
$cs =~ s/\n//g;
$cs =~ s/#\[ti\]/~/g; $cs =~ s/#\[ti\]/~/g;
# entferne kommentarte
$cs =~ s/#.*\n//g;
$cs =~ s/\n//g;
my $x =0; my $x =0;
while ( $cs =~ m/(.*)\[(.*)\:(.*)\](.*)/ ) while ( $cs =~ m/(.*)\[(.*)\:(.*)\](.*)/ )
{ {
@ -6336,7 +6370,6 @@ return $todec;
1; 1;
=pod =pod
=item helper =item helper
=item summary MultiswitchModul =item summary MultiswitchModul
@ -6497,3 +6530,4 @@ MSwitch is an auxiliary module that works both event- and time-controlled. <br /
=cut =cut