diff --git a/fhem/FHEM/98_MSwitch.pm b/fhem/FHEM/98_MSwitch.pm index e1e3c8626..f2d9b8e19 100644 --- a/fhem/FHEM/98_MSwitch.pm +++ b/fhem/FHEM/98_MSwitch.pm @@ -89,7 +89,7 @@ if ( $preconf && $preconf ne "" ) { } my $autoupdate = 'off'; #off/on -my $version = '2.63'; +my $version = '2.7'; my $vupdate = 'V2.00'; # versionsnummer der datenstruktur . änderung der nummer löst MSwitch_VUpdate aus . my $savecount = 30; # anzahl der zugriff im zeitraum zur auslösung des safemodes. kann durch attribut überschrieben werden . my $standartstartdelay = 60; # zeitraum nach fhemstart , in dem alle aktionen geblockt werden. kann durch attribut überschrieben werden . @@ -230,6 +230,7 @@ sub MSwitch_Initialize($) { $hash->{AttrList} = " disable:0,1" . " disabledForIntervals" + . " MSwitch_Language:EN,DE" . " stateFormat:textField-long" . " MSwitch_Comments:0,1" . " MSwitch_Read_Log:0,1" @@ -265,8 +266,14 @@ sub MSwitch_Initialize($) { . " readingList:textField-long " . " MSwitch_Eventhistory:0,1,2,3,4,5,10,20,30,40,50,60,70,80,90,100,150,200" . " textField-long " - . $readingFnAttributes; + + . $readingFnAttributes; $hash->{FW_addDetailToSummary} = 0; + + + + #. " MSwitch_Develop_Affected:textField-long" + #. " MSwitch_Develop_Trigger:textField-long" } #################### sub MSwitch_Rename($) { @@ -726,7 +733,7 @@ sub MSwitch_Define($$) { $hash->{INIT} = 'fhem.save'; } -Log3( $name, 0, "start checkinitdone ".$init_done );#LOG +#Log3( $name, 5, "start checkinitdone ".$init_done );#LOG if ( $init_done && !defined( $hash->{OLDDEF} ) ) @@ -1320,14 +1327,14 @@ my %setlist; } else { - return "Unknown argument $cmd, choose one of exec_cmd_1 exec_cmd_2 reset_device:noArg state backup_MSwitch:all_devices $setList $special"; + return "Unknown argument $cmd, choose one of del_repeats:noArg del_delays:noArg exec_cmd_1 exec_cmd_2 reset_device:noArg state backup_MSwitch:all_devices $setList $special"; } } else { #full - return "Unknown argument $cmd, choose one of reset_device:noArg active:noArg del_function_data:noArg inactive:noArg on off del_delays:noArg backup_MSwitch:all_devices fakeevent exec_cmd_1 exec_cmd_2 wait del_repeats:noArg reload_timer:noArg change_renamed reset_cmd_count:1,2,all $setList $special"; + return "Unknown argument $cmd, choose one of del_repeats:noArg reset_device:noArg active:noArg del_function_data:noArg inactive:noArg on off del_delays:noArg backup_MSwitch:all_devices fakeevent exec_cmd_1 exec_cmd_2 wait del_repeats:noArg reload_timer:noArg change_renamed reset_cmd_count:1,2,all $setList $special"; } } @@ -2657,7 +2664,8 @@ sub MSwitch_Attr(@) { if ( $cmd eq 'set' && $aName eq 'disable' && $aVal == 0 ) { - delete( $hash->{READINGS}{Safemode} ); + delete( $hash->{helper}{savemodeblock} ); + delete( $hash->{READINGS}{Safemode} ); MSwitch_Createtimer($hash); if ( ReadingsVal( $name, 'Trigger_device', 'no_trigger' ) ne 'no_trigger' @@ -2735,6 +2743,7 @@ sub MSwitch_Attr(@) { my $attrzerolist = " disable:0,1" + . " MSwitch_Language:EN,DE" . " MSwitch_Debug:0,1" . " disabledForIntervals" . " MSwitch_Expert:0,1" @@ -2751,11 +2760,13 @@ sub MSwitch_Attr(@) { . " MSwitch_Event_Id_Distributor:textField-long " . " setList:textField-long " . " readingList:textField-long " - . " MSwitch_Develop_Affected:textField-long" - . " MSwitch_Develop_Trigger:textField-long" . " textField-long "; setDevAttrList($name, $attrzerolist); + + + #. " MSwitch_Develop_Affected:textField-long" + #. " MSwitch_Develop_Trigger:textField-long" } if ( $aName eq 'MSwitch_Mode' && $aVal eq 'Notify' ) @@ -3679,6 +3690,78 @@ sub MSwitch_fhemwebFn($$$$) { my $j1 = ''; my $border = 0; + my $ver = ReadingsVal( $Name, '.V_Check', '' ); + + + + + + +#################### TEXTSPRACHE +my $LOOPTEXT; +my $ATERROR; +my $PROTOKOLL2; +my $PROTOKOLL3; +my $CLEARLOG; +my $WRONGSPEC1; +my $WRONGSPEC2; +my $HELPNEEDED; +my $WRONGCONFIG; +my $VERSIONCONFLICT; +my $INACTIVE; +my $OFFLINE; +my $NOCONDITION; +my $MSDISTRIBUTORTEXT; +my $MSDISTRIBUTOREVENT; + +if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + + $MSDISTRIBUTORTEXT="Evenz zu ID Verteilung (einstellung über Attribut)"; + $MSDISTRIBUTOREVENT="eingehendes EventEvent"; + $LOOPTEXT= "ACHTUNG: Der Safemodus hat eine Endlosschleife erkannt, welche zum Fhemabsturz führen könnte.
Dieses Device wurde automatisch deaktiviert ( ATTR 'disable') !
 "; + $ATERROR="AT-Kommandos können nicht ausgeführt werden !"; + $PROTOKOLL2="Das Device befindet sich im Debug 2 Mode. Es werden keine Befehle ausgeführt, sondern nur protokolliert."; + $PROTOKOLL3="Das Device befindet sich im Debug 3 Mode. Alle Aktionen werden protokolliert."; + $CLEARLOG="lösche Log"; + $WRONGSPEC1="Format HH:MM
HH muss kleiner 24 sein
MM muss < 60 sein
Timer werden nicht ausgeführt"; + $WRONGSPEC2="Format HH:MM
HH muss < 24 sein
MM muss < 60 sein
Bedingung gilt immer als FALSCH"; + $HELPNEEDED="Eingriff erforderlich !"; + $WRONGCONFIG="Einspielen des Configfiles nicht möglich !
falsche Versionsnummer:"; + $VERSIONCONFLICT="Versionskonflikt erkannt!
Das Device führt derzeit keine Aktionen aus. Bitte ein Update des Devices vornehmen.
Erwartete Strukturversionsnummer: $vupdate
Vorhandene Strukturversionsnummer: $ver "; + $INACTIVE="Device ist nicht aktiv"; + $OFFLINE="Device ist abgeschaltet, Konfiguration ist möglich"; + $NOCONDITION="Es ist keine Bedingung definiert, das Kommando wird immer ausgeführt"; + } + else + { + $MSDISTRIBUTORTEXT="Event to ID distributor (Settings via attribute)"; + $MSDISTRIBUTOREVENT="incommming Event:"; + $LOOPTEXT= "ATTENTION: The safe mode has detected an endless loop, which could lead to a crash.
This device has been deactivated automatically ( ATTR 'disable') !
 "; + $ATERROR="AT commands can not be executed!"; + $PROTOKOLL2="The device is in Debug 2 mode, no commands are executed, only logged."; + $PROTOKOLL3="The device is in debug 3 mode. All actions are logged."; + $CLEARLOG="clear log"; + $WRONGSPEC1="Format HH: MM
HH must be less than 24
MM must be <60
Timers are not executed"; + $WRONGSPEC2="Format HH: MM
HH must be <24
MM must be <60
Condition is always considered FALSE"; + $HELPNEEDED="Intervention required !"; + $WRONGCONFIG="Importing the Configfile not possible!
wrong version number:"; + $VERSIONCONFLICT="Version conflict detected!
The device is currently not executing any actions. Please update the device.
Expected Structure Version Number: $vupdate
Existing Structure Version Number: $ver"; + $INACTIVE="Device is inactive"; + $OFFLINE="Device is disabled, configuration avaible"; + $NOCONDITION="No condition is defined, the command is always executed"; + } + + +#################### + + + + + + + + # lösche saveddevicecmd # if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) @@ -4144,7 +4227,7 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $triggerdevices .=""; # filter auf argumente on oder off ; if ( $name eq '' ) { next LOOP9; } - my $cs = "set $name ?"; + # abfrage und auswertung befehlssatz if ( $MSwitchIncludeDevicecmds eq '1' and $hash->{INIT} ne "define" ) { if ( exists $hash->{helper}{devicecmds1}{$name} @@ -4154,8 +4237,8 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $errors = $hash->{helper}{devicecmds1}{$name}; } else { - - $errors = AnalyzeCommandChain( undef, $cs ); + #$errors = AnalyzeCommandChain( undef, $cs ); + $errors = getAllSets($name); if ( $savecmds ne "nosave" ) { $hash->{helper}{devicecmds1}{$name} = $errors; $hash->{helper}{last_devicecmd_save} = time; @@ -4167,17 +4250,21 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $errors = ''; } - if ( !defined $errors ) { $errors = '' } - my @tmparg = split( /of /, $errors ); - if ( !defined $tmparg[1] ) { $tmparg[1] = "" } - if ( $tmparg[1] ne '' ) - { - $errors = $tmparg[1]; - } - else - { - $errors = ''; - } + if ( !defined $errors ) + { + $errors = ''; + } + + # my @tmparg = split( /of /, $errors ); + # if ( !defined $tmparg[1] ) { $tmparg[1] = "" } + # if ( $tmparg[1] ne '' ) + # { + # $errors = $tmparg[1]; + # } + # else + # { + # $errors = ''; + # } $errors = '|' . $errors; $errors =~ s/\| //g; @@ -4271,13 +4358,326 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) #################### # #devices details +# steuerdatei + my $controlhtml; + $controlhtml =" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
MS-NAMESATZMS-HELPpriority MS-IDSATZ
+
MS-COMMENTset
CMD 1     
MS-HELPonoffMS-SET1
MS-HELPconditionMS-COND1
MS-CONDCHECK1
MS-HELPexeccmdMS-EXEC1
MS-HELPdelayMS-DELAYset1
CMD 2     
MS-HELPonoffMS-SET2
MS-HELPconditionMS-COND2
MS-CONDCHECK2
MS-HELPexeccmdMS-EXEC2
MS-HELPdelayMS-DELAYset2
MS-HELPrepeats MS-REPEATset
 MS-ACTIONSATZ
+
+"; + + + my $controlhtmlalternativ=" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MS-COMMENTset
MS-NAMESATZ MS-HELPpriority MS-IDSATZ
CMD 1 CMD 2
 
MS-HELPonoffMS-SET1 MS-SET2
MS-HELPcondition MS-COND1  MS-COND2
MS-CONDCHECK1MS-CONDCHECK1
MS-HELPexitMS-EXEC1MS-EXEC2
MS-HELPtimerMS-DELAYset1 MS-DELAYset2
 
MS-HELPrepeats MS-REPEATset
MS-ACTIONSATZ

+"; + + $controlhtml = AttrVal( $Name, 'MSwitch_Develop_Affected', $controlhtml ) ; + #### extrakt ersetzung + my $extrakt = $controlhtml; + + $extrakt =~ s/\n/#/g; + + my $extrakthtml = $extrakt; + +# umstellen auf globales attribut !!!!!! + if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + $extrakt =~m/start:textersetzung:ger(.*)end:textersetzung:ger/ ; + $extrakt = $1; + } + else + { + $extrakt =~m/start:textersetzung:eng(.*)end:textersetzung:eng/ ; + $extrakt = $1; + } + + my @translate; + if(defined $extrakt) + { + $extrakt =~ s/^.//; + $extrakt =~ s/.$//; + @translate = split(/#/,$extrakt); + } + + $controlhtml =~m/MS-cellhigh=(.*);/ ; + my $cellhight =$1."px"; + my $cellhightexpert =$1."px"; + my $cellhightdebug =$1."px"; + + +# +$extrakthtml =~m/(.*)/ ; +$controlhtml=$1; +$controlhtml=~ s/#/\n/g; + #MSwitch_LOG( $Name, 0, "HTML " . $controlhtml ); + + # detailsatz in scalar laden -# my @devicedatails = split(/:/,ReadingsVal($Name, '.Device_Affected_Details', '')); #inhalt decice und cmds # durch komma getrennt - my %savedetails = MSwitch_makeCmdHash($Name); + my %savedetails = MSwitch_makeCmdHash($Name); my $detailhtml = ""; my @affecteddevices = split( /,/, ReadingsVal( $Name, '.Device_Affected', 'no_device' ) ); - ##################################### MSwitch_LOG( $Name, 5, "$Name: -> @affecteddevices" ); if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' && ReadingsVal( $Name, '.sortby', 'none' ) eq 'priority' ) @@ -4299,17 +4699,64 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) { $affecteddevices[0] = 'no_device'; } + + + my $sortierung =""; + my $modify=""; + my $IDsatz=""; + my $NAMEsatz=""; + my $ACTIONsatz=""; + my $SET1=""; + my $SET2=""; + my $COND1set1=""; + + my $COND1check1=""; + my $COND2check2=""; + + my $COND1set2=""; + my $EXECset1=""; + my $EXECset2=""; + my $DELAYset1=""; + my $DELAYset2=""; + my $REPEATset=""; + my $COMMENTset=""; + + my $HELPpriority =""; + my $HELPonoff =""; + my $HELPcondition =""; + my $HELPexit=""; + my $HELPtimer=""; + my $HELPrepeats=""; + my $HELPexeccmd=""; + my $HELPdelay=""; + + if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) + { + $HELPpriority = ""; + $HELPonoff = ""; + $HELPcondition = ""; + $HELPexit=""; + $HELPtimer=""; + $HELPrepeats=""; + $HELPexeccmd=""; + $HELPdelay=""; + } + + + if ( $affecteddevices[0] ne 'no_device' ) { - $detailhtml =""; + ####################### sortierungsblock + $sortierung =""; if ( $hash->{INIT} ne 'define' ) { - $detailhtml .= " - "; #start + $sortierung .=''; } +################################# + + + $modify = "
device actions sortby: - "; + $sortierung .= " + device actions sortby: + "; my $select = ReadingsVal( $Name, '.sortby', 'none' ); + if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) ne '1'&& $select eq 'priority' ) { $select = 'none'; @@ -4322,23 +4769,47 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $nonef = 'selected="selected"' if $select eq 'none'; $priorityf = 'selected="selected"' if $select eq 'priority'; $showf = 'selected="selected"' if $select eq 'show'; - $detailhtml .= ' - '; + if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' ) { - $detailhtml .= - ''; + $sortierung .=' + '; } - $detailhtml .= - ''; - $detailhtml .= "
 
+
+  $sortierung +
+ "; + + +########################## +# $detailhtml .= $sortierung; +########################## + + #my $detailhtmlold; + + my $alert; foreach (@affecteddevices) { + + $IDsatz=""; + $ACTIONsatz=""; + $COND1set1=""; + $COND1set2=""; + $EXECset1=""; + $EXECset2=""; + $COMMENTset=""; + my $nopoint = $_; $nopoint =~ s/\./point/g; $alert = ''; @@ -4422,7 +4893,6 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) { my $key = ''; $key = $aktdevice . "_timeon"; - #$savedetails{$key} = '000000'; #change $savedetails{$key} = '00:00:00'; } @@ -4431,7 +4901,6 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) { my $key = ''; $key = $aktdevice . "_timeoff"; - #$savedetails{$key} = '000000'; #change $savedetails{$key} = '00:00:00'; } @@ -4518,28 +4987,18 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' ) { - $detailhtml = $detailhtml . " - - "; - $detailhtml = $detailhtml - . "$zusatz $devicenamet $realname   $dalias $alert - "; + $NAMEsatz = "$zusatz $devicenamet $realname   $dalias $alert"; ###################### priority + my $aktfolge = $reihenfolgehtml; my $newname = "reihe" . $nopoint; my $tochange =""; my $change =""; $aktfolge =~ s/reihe/$newname/g; $aktfolge =~ s/$tochange/$change/g; - $detailhtml = $detailhtml . ""; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml - . " "; - } - $detailhtml = $detailhtml . "priority: " . $aktfolge . " "; + + $IDsatz="priority: " . $aktfolge . " "; # ende # show @@ -4551,8 +5010,9 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $change =""; $aktfolge =~ s/showreihe/$newname/g; $aktfolge =~ s/$tochange/$change/g; - $detailhtml = $detailhtml . "show: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' ); + $IDsatz.="show: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' ); +#### # ID $aktfolge = $idfolgehtml; $newname = "idreihe" . $nopoint; @@ -4560,27 +5020,25 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $change =""; $aktfolge =~ s/idreihe/$newname/g; $aktfolge =~ s/$tochange/$change/g; - $detailhtml = $detailhtml . "ID: " . $aktfolge; - $detailhtml = $detailhtml . ""; + + $IDsatz.="ID: " . $aktfolge; + # ende } else { - $detailhtml = $detailhtml . ""; - $detailhtml = $detailhtml. "$zusatz $devicenamet $realname   $dalias $alert"; - + $NAMEsatz="$zusatz $devicenamet $realname   $dalias $alert"; my $aktfolge = $showfolgehtml; my $newname = "showreihe" . $nopoint; my $tochange =""; my $change =""; $aktfolge =~ s/showreihe/$newname/g; $aktfolge =~ s/$tochange/$change/g; - $detailhtml = $detailhtml . ""; - $detailhtml = $detailhtml . "show : " . $aktfolge . " " if ( $hash->{INIT} ne 'define' ); - $detailhtml = $detailhtml . ""; + + $IDsatz.= "show : " . $aktfolge . " " if ( $hash->{INIT} ne 'define' ); + } - $detailhtml = $detailhtml . ""; - + ##### bis hier ok hier ist nach überschrift ##### kommentare my $noschow = "style=\"display:none\""; @@ -4589,117 +5047,96 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $noschow = ''; } - $detailhtml = $detailhtml . " - - - - "; - $detailhtml = $detailhtml . ""; - my $rephide = "style='display:none;'"; - my $rows = 7; - if ( $hash->{INIT} eq 'define' ) - { - $rows = 2; - } +#kommentar + if ( AttrVal( $Name, 'MSwitch_Comments', "0" ) eq '1' ) + { + my @a=split(/\n/,$savedetails{ $aktdevice . '_comment' }); + my $lines = @a; + $lines =1 if $lines == 0; + + $COMMENTset = ""; + } + + + # my $rephide = "style='display:none;'"; + # my $rows = 7; + # if ( $hash->{INIT} eq 'define' ) + # { + # $rows = 2; + # } + + # if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' ) + # { + # $rephide = ''; + # $rows = 8; #8 + # } - if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' ) - { - $rephide = ''; - $rows = 8; #8 - } - $detailhtml = $detailhtml . "              "; - $detailhtml = $detailhtml . ""; if ( $devicenamet ne 'FreeCmd' ) { - # nict freecmd - $detailhtml = $detailhtml . " - - - - -
-
"; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - $detailhtml = $detailhtml . "MSwitch 'cmd1': - Set -
 
- - -  
-    "; + # nicht freecmd + + $SET1 = " +
+ Set + + + +
+ "; + } else { # freecmd $savedetails{ $aktdevice . '_onarg' } =~ s/'/'/g; - $detailhtml = $detailhtml . " - - - - - - -
"; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - - $detailhtml = $detailhtml . "MSwitch 'cmd1' : -
- "; - $detailhtml = $detailhtml . " - -  
"; - } - $detailhtml = $detailhtml . ""; + $SET1 = ""; + " + + "; + } + + ######################## ## block off #$devicename @@ -4707,20 +5144,8 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) { if ( $devicenamet ne 'FreeCmd' ) { - $detailhtml = $detailhtml . " - - - - - -
- "; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - - $detailhtml = $detailhtml . "MSwitch 'cmd2': - Set
+ Set -  
- - - - + ".$option2html." +    "; + . "'> + + + "; + } else { $savedetails{ $aktdevice . '_offarg' } =~ s/'/'/g; - $detailhtml = $detailhtml . " - - - - - - -
"; - # even - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml - . " "; - } - $detailhtml = $detailhtml . "MSwitch 'cmd2' : -
- - - - - "; - } - $detailhtml = $detailhtml . ""; - } - else - { - $detailhtml = $detailhtml . "ffff"; } - $detailhtml = $detailhtml . " - - "; + $SET2= " + + + + "; + } + } + else + { + #nothing + } - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - - $detailhtml = $detailhtml - . "'cmd1' condition:    "; + $COND1set1= "condition: "; my $exit1 = ''; $exit1 = 'checked' if $savedetails{ $aktdevice . '_exit1' } eq '1'; if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' ) { - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - - $detailhtml = - $detailhtml - . " execute and exit if applies"; + $EXECset1=" execute and exit if applies"; } else - { - $detailhtml = - $detailhtml - . " "; + { + $EXECset1.=" "; } if ( AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '1' ) { - $detailhtml = - $detailhtml - . " with \$EVENT="; +$COND1check1=" with \$EVENT="; } #alltriggers - $detailhtml = $detailhtml . ""; + if ( $hash->{INIT} ne 'define' ) { - $detailhtml = $detailhtml . " - "; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - - $detailhtml = - $detailhtml - . "'cmd2' condition:    "; + . "' onClick=\"javascript:bigwindow(this.id);\">"; + my $exit2 = ''; - $exit2 = 'checked' - if $savedetails{ $aktdevice . '_exit2' } eq '1'; + $exit2 = 'checked' if $savedetails{ $aktdevice . '_exit2' } eq '1'; if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '1' ) - { - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml . " "; - } - $detailhtml = $detailhtml - . " execute and exit if applies"; + { + $EXECset2=" execute and exit if applies"; } else { - $detailhtml = $detailhtml - . " "; + $EXECset2.=" "; } if ( AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '1' ) - { - $detailhtml = $detailhtml - . " with \$EVENT="; + { + $COND2check2=" with \$EVENT="; } #### zeitrechner @@ -4972,19 +5331,8 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $timestron = "[random]"; } - $detailhtml = $detailhtml . " - "; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml - . " "; - } - - $detailhtml = - $detailhtml - . "'cmd1' "; + my $se11 = ''; my $sel2 = ''; my $sel3 = ''; @@ -5006,41 +5354,31 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $sel6 = 'selected' if ( $savedetails{ $aktdevice . '_delayaton' } eq "at2" ); - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - $detailhtml = - $detailhtml - . "delay with Cond-check immediately and delayed: +"; + # $DELAYset1 .= ""; + # $DELAYset1 .= ""; + # $DELAYset1 .= ""; + # $DELAYset1 .=""; + # $DELAYset1 .= ""; + # $DELAYset1 .= " delay with Cond-check immediately and delayed:"; + $DELAYset1 .= ""; + $DELAYset1 .= ""; + $DELAYset1 .= ""; + $DELAYset1 .=""; + $DELAYset1 .= ""; + $DELAYset1 .= " (hh:mm:ss)"; - $detailhtml = $detailhtml . " - - "; + . "'> (hh:mm:ss)"; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml - . " "; - } - - $detailhtml = $detailhtml - . "'cmd2' "; $se11 = ''; $sel2 = ''; @@ -5057,82 +5395,142 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $sel3 = 'selected' if ( $savedetails{ $aktdevice . '_delayatoff' } eq "at1" ); $sel6 = 'selected' if ( $savedetails{ $aktdevice . '_delayatoff' } eq "at2" ); - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - - $detailhtml = $detailhtml - . ""; - - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml - . ""; - - $detailhtml = - $detailhtml - . "delay with Cond-check immediately and delayed: +"; + # $DELAYset2 .= ""; + # $DELAYset2 .= ""; + # $DELAYset2 .= ""; + # $DELAYset2 .= ""; + # $DELAYset2 .= ""; + # $DELAYset2 .= "delay with Cond-check immediately and delayed:"; + $DELAYset2 .= ""; + $DELAYset2 .= ""; + $DELAYset2 .= ""; + $DELAYset2 .= ""; + $DELAYset2 .= ""; + $DELAYset2 .= " (hh:mm:ss)   "; + . "'> (hh:mm:ss)"; - $detailhtml = $detailhtml . ""; - ############################################################################# - $detailhtml = $detailhtml . " - "; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $detailhtml = $detailhtml - . " "; - } - - $detailhtml = $detailhtml . "Repeats: - -     - Repeatdelay in sec: - - "; - $detailhtml = $detailhtml . " - -
- "; - $detailhtml = $detailhtml . " - "; + . $savedetails{ $aktdevice . '_repeattime' } . "'>"; + + + + } + - if ( $devicenumber == 1 ) + if ( $devicenumber == 1 ) { - $detailhtml = $detailhtml - . " 
"; + $ACTIONsatz = ""; } - $detailhtml = $detailhtml - . ""; - $detailhtml = $detailhtml . "
 "; + $ACTIONsatz .= " "; } else { #nothimg } + +######################################## neu ############################################## + my $controlhtmldevice = $controlhtml; + + + + + + + # ersetzung in steuerdatei + # MS-IDSATZ ... $IDsatz + $controlhtmldevice =~ s/MS-IDSATZ/$IDsatz/g; + # MS-NAMESATZ ... $NAMEsatz + $controlhtmldevice =~ s/MS-NAMESATZ/$NAMEsatz/g; + # MS-ACTIONSATZ ... $ACTIONsatz + $controlhtmldevice =~ s/MS-ACTIONSATZ/$ACTIONsatz/g; + # MS-SET1 ... $SET1 + $controlhtmldevice =~ s/MS-SET1/$SET1/g; + $controlhtmldevice =~ s/MS-SET2/$SET2/g; + # MS-COND ... $COND1set + $controlhtmldevice =~ s/MS-COND1/$COND1set1/g; + $controlhtmldevice =~ s/MS-COND2/$COND1set2/g; + # MS-EXEC ... $EXECset1 + $controlhtmldevice =~ s/MS-EXEC1/$EXECset1/g; + $controlhtmldevice =~ s/MS-EXEC2/$EXECset2/g; + # MS-DELAY1 ... $DELAYset1 + $controlhtmldevice =~ s/MS-DELAYset1/$DELAYset1/g; + $controlhtmldevice =~ s/MS-DELAYset2/$DELAYset2/g; + # MS-REPEATset $REPEATset + $controlhtmldevice =~ s/MS-REPEATset/$REPEATset/g; + #$COMMENTsatz $MSComment + $controlhtmldevice =~ s/MS-COMMENTset/$COMMENTset/g; + + $controlhtmldevice =~ s/MS-CONDCHECK1/$COND1check1/g; + $controlhtmldevice =~ s/MS-CONDCHECK2/$COND2check2/g; + ##### + #zellenhöhe + + if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) eq '0' ) + { + $cellhightexpert ="0px"; + } + if ( AttrVal( $Name, 'MSwitch_Debug', "0" ) ne '1' ) + { + $cellhightdebug="0px"; + } + + + $controlhtmldevice =~ s/MS-cellhighstandart/$cellhight/g; + $controlhtmldevice =~ s/MS-cellhighexpert/$cellhightexpert/g; + $controlhtmldevice =~ s/MS-cellhighdebug/$cellhightdebug/g; + #$controlhtmldevice =~ s/MS-CONDCHECK2/$COND2check2/g; + #MS-cellhigh +#MS-cellhighexpert +#MS-cellhighdebug + + + #HELPcondition + if ( AttrVal( $Name, 'MSwitch_Expert', "0" ) ne '1' ) + { + $HELPexit=""; + $HELPrepeats=""; + $HELPexeccmd=""; + } + $controlhtmldevice =~ s/MS-HELPpriority/$HELPpriority/g; + $controlhtmldevice =~ s/MS-HELPonoff/$HELPonoff/g; + $controlhtmldevice =~ s/MS-HELPcondition/$HELPcondition/g; + $controlhtmldevice =~ s/MS-HELPexit/$HELPexit/g; + $controlhtmldevice =~ s/MS-HELPtimer/$HELPtimer/g; + $controlhtmldevice =~ s/MS-HELPrepeats/$HELPrepeats/g; + $controlhtmldevice =~ s/MS-HELPexeccmd/$HELPexeccmd/g; + $controlhtmldevice =~ s/MS-HELPdelay/$HELPdelay/g; -#middle +# textersetzung +foreach (@translate) +{ +my($wert1,$wert2) = split (/->/,$_); +$controlhtmldevice =~ s/$wert1/$wert2/g; +} + $detailhtml.= "
". + $controlhtmldevice. + "
"; + ##### # javazeile für übergabe erzeugen $javaform = $javaform . " devices += \$(\"[name=devicename$nopoint]\").val(); @@ -5177,14 +5575,23 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) devices += \$(\"[name=showreihe$nopoint]\").val(); devices += '#[DN]'; "; - } -#################### - $detailhtml = $detailhtml; - $detailhtml = $detailhtml . " - - "; #end + } + + + +# textersetzung modify +foreach (@translate) +{ +my($wert1,$wert2) = split (/->/,$_); +$modify =~ s/$wert1/$wert2/g; +} + +$detailhtml .= $modify; + } +# ende kommandofelder + #################### my $triggercondition = ReadingsVal( $Name, '.Trigger_condition', '' ); @@ -5223,28 +5630,40 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) ######################## my $blocking = ''; $blocking = $hash->{helper}{savemodeblock}{blocking} if ( defined $hash->{helper}{savemodeblock}{blocking} ); - if ( $blocking eq 'on' ) + + + + + + + +# endlosschleife + if ( $blocking eq 'on' ) { $ret .= " -
 
ACHTUNG: Der Safemodus hat eine Endlosschleife erkannt, welche zum Fhemabsturz führen könnte.
Dieses Device wurde automatisch deaktiviert ( ATTR 'disable') !
  -

 
+
 
$LOOPTEXT"; + $ret .= "
"; } +###################### +# AT fehler my $errortest = ""; $errortest = $hash->{helper}{error} if ( defined $hash->{helper}{error} ); - if ( $errortest ne "" ) { $ret .= " -
 
AT-Kommandos können nicht ausgeführt werden !
" +
 
$ATERROR
" . $errortest . "
 

 
"; } + +# debugmode + if ( AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '2' || AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '3' ) { @@ -5256,11 +5675,8 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) } close(BACKUPDATEI); my $text = ""; - $text ="Das Device befindet sich im Debug 2 Mode. Es werden keine Befehle ausgeführt, sondern nur protokolliert." - if AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '2'; - - $text ="Das Device befindet sich im Debug 3 Mode. Alle Aktionen werden protokolliert." - if AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '3'; + $text =$PROTOKOLL2 if AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '2'; + $text =$PROTOKOLL3 if AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '3'; $ret .= " @@ -5270,13 +5686,16 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) . $Zeilen . "
 
+ value=\"$CLEARLOG\" onClick=\"clearlog();\">
 


"; } + + # einblendung wrong timespec + if ( defined $hash->{helper}{wrongtimespec} and $hash->{helper}{wrongtimespec} ne "" ) { $ret .= " @@ -5285,10 +5704,12 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )

 "; $ret .= $hash->{helper}{wrongtimespec}; $ret .= -"
use HH:MM
HH must be < 24
MM must be < 60
Timer werden nicht ausgeführt
"; +"
$WRONGSPEC1
"; $ret .= "
 
-
+ "; + + # use HH:MM
HH must be < 24
MM must be < 60
Timer werden nicht ausgeführt } if ( defined $hash->{helper}{wrongtimespeccond} and $hash->{helper}{wrongtimespeccond} ne "" ) @@ -5299,10 +5720,11 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )

 "; $ret .= $hash->{helper}{wrongtimespeccond}; $ret .= -"
use HH:MM
HH must be < 24
MM must be < 60
Bedingung gilt immer als FALSCH
"; +"
$WRONGSPEC2
"; $ret .= "
 
-
+ "; + #use HH:MM
HH must be < 24
MM must be < 60
Bedingung gilt immer als FALSCH } # einblendung info @@ -5313,10 +5735,15 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )

 "; $ret .= ReadingsVal( $Name, '.info', '' ); $ret .= "
 
-
+ "; } + + + + + # anpassung durch configeinspielung if ( ReadingsVal( $Name, '.change', 'undef' ) ne "undef" ) { @@ -5371,11 +5798,11 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $out .= ""; $count++; } - +################################################# $ret .= " - " . $out . " @@ -5384,9 +5811,9 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) value=\"save changes\" onClick=\"changedevices();\">
 
 
Eingriff erforderlich !
 "; +
 
$HELPNEEDED
 "; $ret .= ReadingsVal( $Name, '.change_info', '' ); $ret .= "

-
+ "; - +################################################### $j1 = ""; return "$ret" . "$j1"; } + +######################################### if ( ReadingsVal( $Name, 'state', 'undef' ) eq "inactive" ) { $ret .= " -
 
Device is inactive
 
+
 
$INACTIVE
 
"; } elsif ( IsDisabled($Name) ) { $ret .= " -
 
Device is disabled, configuration avaible
 
+
 
$OFFLINE
 

"; } #################### - my $inhalt = "execute 'cmd1' only at :"; - my $inhalt1 = "execute 'cmd2' only at :"; - my $inhalt6 = "execute 'cmd1+cmd2' only at :"; - my $inhalt2 = "execute 'cmd1' only"; - my $inhalt3 = "execute 'cmd2' only"; - my $inhalt4 = "switch MSwitch on + execute 'cmd1' at :"; - my $inhalt5 = "switch $Name on + execute 'cmd1'"; + + +# trigger start + +my $triggerhtml =" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
trigger device/time
MS-HELPdevicetrigger device MS-TRIGGER
MS-HELPwhitelistTrigger Device Global Whitelist MS-WHITELIST
MS-HELPtimeswitch MSwitch on and execute CMD1 atMS-ONAND1
MS-HELPexecdmd switch MSwitch off and execute CMD2 atMS-ONAND2
 trigger timeexecute CMD1 onlyMS-EXEC1
  execute CMD2 onlyMS-EXEC2
  execute CMD1 and CMD2 onlyMS-EXECALL
MS-HELPcondMS-CONDTEXT MS-CONDITION MS-CHECKCONDITION
MS-modify
+"; + +$triggerhtml = AttrVal( $Name, 'MSwitch_Develop_Trigger', $triggerhtml ) ; + +my $extrakt1 = $triggerhtml; +$extrakt1 =~ s/\n/#/g; + + + if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + $extrakt1 =~m/start:textersetzung:ger(.*)end:textersetzung:ger/ ; + $extrakt1 = $1; + } + else + { + $extrakt1 =~m/start:textersetzung:eng(.*)end:textersetzung:eng/ ; + $extrakt1 = $1; + } + +@translate; + if(defined $extrakt1) + { + $extrakt1 =~ s/^.//; + $extrakt1 =~ s/.$//; + @translate = split(/#/,$extrakt1); + } + + + +my $MSHELPexeccmd=""; +my $MSHEPLtrigger=""; +my $MSHEPLwhitelist=""; +my $MSHEPtime=""; +my $MSHELPcond=""; +my $MStrigger=""; +my $MSwhitelist=""; +my $MSmodify=""; +my $MScondition=""; +my $MSonand1=""; +my $MSonand2=""; +my $MSexec1=""; +my $MSexec2=""; +my $MSexec12=""; +my $MSconditiontext=""; +my $MShidefull=""; +my $MSHidedummy=""; +my $MSHidewhitelist="id='triggerwhitelist'"; +my $MScheckcondition=""; + + # my $inhalt2 = "execute 'cmd1' only"; + # my $inhalt3 = "execute 'cmd2' only"; + my $inhalt5 = "switch $Name on and execute cmd1"; my $displaynot = ''; my $displayntog = ''; my $help = ""; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $help =" "; - } + my $visible = 'visible'; if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) eq "Notify" ) { + $MShidefull="style='display:none;'"; $displaynot = "style='display:none;'"; - $inhalt = "execute 'cmd1' at :"; - $inhalt1 = "execute 'cmd2' at :"; - $inhalt2 = $help . "execute 'cmd1'"; - $inhalt3 = $help . "execute 'cmd2'"; + # $inhalt2 = $help . "execute 'cmd1'"; + # $inhalt3 = $help . "execute 'cmd2'"; } + if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) eq "Toggle" ) { $displayntog = "style='display:none;'"; - $inhalt4 = "toggle $Name + execute 'cmd1/cmd2' at :"; - $inhalt5 = "toggle $Name + execute 'cmd1/cmd2'"; + $inhalt5 = "toggle $Name and execute cmd1/cmd2"; } - if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) eq "Dummy" ) - { - $displaynot = "style='display:none;'"; - $inhalt = "execute 'cmd1' at :"; - $inhalt1 = "execute 'cmd2' at :"; - $inhalt2 = $help . "execute 'cmd1'"; - $inhalt3 = $help . "execute 'cmd2'"; - } + # if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) eq "Dummy" ) + # { + # $inhalt2 = $help . "execute 'cmd1'"; + # $inhalt3 = $help . "execute 'cmd2'"; + # } if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) ne "Dummy" ) { - $ret .=""; + $MSHidedummy=""; } else { - $ret .="
"; + $MSHidedummy="style ='visibility: collapse'"; } - $ret .= ""; - $ret .=" - - - - - - - - "; - my $visible = 'visible'; + $MStrigger= ""; + if ( $globalon ne 'on' ) { - $visible = 'collapse'; + $MSHidewhitelist="id='triggerwhitelist' style ='visibility: collapse'"; } - my $visible1 = 'visible'; - if ( $globalon1 ne 'on' ) - { - $visible1 = 'collapse'; - } - $ret =$ret - . " - - - "; - $ret = $ret . " - - - - - - - - - - - - - - - - - - "; + + $MSonand1=""; + $MSonand2=""; + $MSexec1=""; if ( $hash->{INIT} ne 'define' ) { - $ret .= " - - - - "; - - $ret .= " - - - - "; + $MSexec2="" ; + + $MSexec12="" } - - my $triggerinhalt = "Trigger condition (events only): "; + + $MSconditiontext="Trigger condition (events only)"; if ( AttrVal( $Name, 'MSwitch_Condition_Time', "0" ) eq '1' ) { - $triggerinhalt = "Trigger condition (time&events): "; + $MSconditiontext = "Trigger condition (time&events)"; } - $ret = $ret . " - - - "; - $ret = $ret . " - - -
trigger device/time:   "; - $ret .= "
"; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $ret = $ret. " "; - } - $ret .= "Trigger device: - -
"; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $ret = $ret. " "; - } - $ret = $ret . "Trigger Device Global Whitelist: - "; - $ret = $ret . "
"; - - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $ret = $ret. " "; - } - - $ret = $ret . "Trigger time:
" . $inhalt4 . "
switch MSwitch off + execute 'cmd2' at :
" . $inhalt . "
" . $inhalt1 . "
" . $inhalt6 . "
"; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $ret = $ret .=" "; - } - - $ret = $ret . $triggerinhalt . ""; if ( AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '1' ) { - $ret = $ret. " "; - } + $MScheckcondition =" "; + } + + $MScondition= ""; - $ret = $ret . "
- -

"; - #} + + if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) + { + $MSHEPLtrigger=""; + $MSHEPLwhitelist=""; + $MSHEPLtrigger=""; + $help =" "; + $MSHELPcond=""; + } + + $MSmodify = ""; + + $triggerhtml =~ s/MS-HELPexecdmd/$MSHELPexeccmd/g; + $triggerhtml =~ s/MS-HELPdevice/$MSHEPLtrigger/g; + $triggerhtml =~ s/MS-HELPwhitelist/$MSHEPLwhitelist/g; + $triggerhtml =~ s/MS-HELPtime/$MSHEPLtrigger/g; + $triggerhtml =~ s/MS-HELPcond/$MSHELPcond/g; + $triggerhtml =~ s/MS-modify/$MSmodify/g; + $triggerhtml =~ s/MS-TRIGGER/$MStrigger/g; + $triggerhtml =~ s/MS-WHITELIST/$MSwhitelist/g; + $triggerhtml =~ s/MS-CONDITION/$MScondition/g; + $triggerhtml =~ s/MS-ONAND1/$MSonand1/g; + $triggerhtml =~ s/MS-ONAND2/$MSonand2/g; + $triggerhtml =~ s/MS-EXEC1/$MSexec1/g; + $triggerhtml =~ s/MS-EXEC2/$MSexec2/g; + $triggerhtml =~ s/MS-EXECALL/$MSexec12/g; + $triggerhtml =~ s/MS-CONDTEXT/$MSconditiontext/g; + $triggerhtml =~ s/MS-HIDEFULL/$MShidefull/g; + $triggerhtml =~ s/MS-HIDEDUMMY/$MSHidedummy/g; + $triggerhtml =~ s/MS-HIDEWHITELIST/$MSHidewhitelist/g; + $triggerhtml =~ s/MS-CHECKCONDITION/$MScheckcondition/g; + + foreach (@translate) + { + my($wert1,$wert2) = split (/->/,$_); + $triggerhtml =~ s/$wert1/$wert2/g; + } + + $ret.= "
" + .$triggerhtml. + "

"; + + + + + # trigger ende + #################### - # triggerdetails + + + my $MSTRIGGER; + my $MSCMDONTRIGGER=""; + my $MSCMDOFFTRIGGER=""; + my $MSCMD1TRIGGER=""; + my $MSCMD2TRIGGER=""; + my $MSSAVEEVENT=""; + my $MSADDEVENT=""; + my $MSMODLINE=""; + my $MSTESTEVENT=""; + my $MSHELP5=""; + my $MSHELP6=""; + my $triggerdetailhtml=" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
trigger details:
MS-CHANGETEXTMS-TRIGGERMS-ONCMD1TRIGGER
switch $Name off and execute cmd2MS-TRIGGERMS-OFFCMD2TRIGGER
    
execute only cmd1MS-TRIGGERMS-CMD1TRIGGER
execute only cmd2MS-TRIGGERMS-CMD2TRIGGER
MS-HELP5Save incomming eventsMS-SAVEEVENT 
MS-HELP6Add event manuallyMS-ADDEVENT 
MS-MODLINEMS-TESTEVENT
+"; + + + +my $extrakt2 = $triggerdetailhtml; + $extrakt2 =~ s/\n/#/g; + + $extrakthtml = $extrakt2; +# umstellen auf globales attribut !!!!!! +if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + $extrakt2 =~m/start:textersetzung:ger(.*)end:textersetzung:ger/ ; + $extrakt2 = $1; + } + else + { + $extrakt2 =~m/start:textersetzung:eng(.*)end:textersetzung:eng/ ; + $extrakt2 = $1; + } + + @translate=""; + if(defined $extrakt2) + { + $extrakt2 =~ s/^.//; + $extrakt2 =~ s/.$//; + @translate = split(/#/,$extrakt2); + } + +$extrakthtml =~m/(.*)/ ; +$triggerdetailhtml=$1; +$triggerdetailhtml=~ s/#/\n/g; + + + + + + + + my $selectedcheck3 = ""; my $SELF = $Name; my $testlog = ReadingsVal( $Name, 'Trigger_log', 'on' ); @@ -5665,28 +6343,10 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $selftrigger ="1"; $showtriggerdevice = "MSwitch_Self:"; } - if ( ReadingsVal( $Name, 'Trigger_device', 'no_trigger' ) ne 'no_trigger' || $selftrigger ne "") { - $ret .= -" - - - - - - - - - - "; - $ret .= " - - - - - - - "; - - $ret .= " - - - - - - - "; + if ( $hash->{INIT} ne 'define' ) { - $ret .= " - - - - "; } - $ret .= " - - - - - - - - - - - -
trigger details :
"; - $ret .= $inhalt5 . ""; - $ret .= "Trigger " . $showtriggerdevice. " : - "; - $ret .=""; - + $MSTRIGGER="Trigger " . $showtriggerdevice. ""; + $MSCMDONTRIGGER=""; ############## my $fieldon = ""; if ( $triggeron =~ m/{(.*)}/ ) @@ -5697,23 +6357,11 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) MSwitch_LOG( "Debug", 0,"eveal line" . __LINE__ ); } eval($exec); - $ret .=""; - } + $MSCMDONTRIGGER.=""; + } ##################### - $ret .= "
- switch " . $Name . " off + execute 'cmd2' - Trigger " . $showtriggerdevice. " : - "; - $ret .= - ""; + $MSCMDOFFTRIGGER=""; ############## my $fieldoff = ""; @@ -5725,25 +6373,11 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) MSwitch_LOG( "Debug", 0,"eveal line" . __LINE__ ); } eval($exec); - $ret .= -""; + $MSCMDOFFTRIGGER.=""; } ##################### - $ret .= "
 
" . $inhalt2 . " - Trigger " . $showtriggerdevice." : - - "; + $MSCMD1TRIGGER=""; ############## my $fieldcmdon = ""; @@ -5755,24 +6389,15 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) MSwitch_LOG( "Debug", 0,"eveal line" . __LINE__ ); } eval($exec); - $ret .= -""; } - ##################### - $ret .= "
" . $inhalt3 . " - Trigger " . $showtriggerdevice. " : - - "; + $MSCMD2TRIGGER=""; + ############## my $fieldcmdoff = ""; if ( $triggercmdoff =~ m/{(.*)}/ ) { @@ -5782,66 +6407,73 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) MSwitch_LOG( "Debug", 0,"eveal line" . __LINE__ ); } eval($exec); - $ret .= -""; } ##################### - $ret .= "
"; + $MSSAVEEVENT=""; if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) { - $ret = $ret . " "; - } - - $ret = $ret . "Save incomming events : -
"; - if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) - { - $ret = $ret . " "; - } - $ret .= "Add event manually : - - + $MSHELP5=" "; + $MSHELP6=" "; + } + $MSADDEVENT=" "; - - $ret .= " -
- + $MSMODLINE=" -     - "; - + "; + if ( AttrVal( $Name, 'MSwitch_Debug', "0" ) eq '1' && $optiongeneral ne '' ) { - $ret .="" . $optiongeneral . ""; - } - $ret .= "

"; + + } } else { -# ACHTUNG - $ret .= "

"; + $triggerdetailhtml= "

"; } +############################################################## + +#MS-HIDEWHITELIST + $triggerdetailhtml =~ s/MS-OFFCMD2TRIGGER/$MSCMDOFFTRIGGER/g; + $triggerdetailhtml =~ s/MS-ONCMD1TRIGGER/$MSCMDONTRIGGER/g; + $triggerdetailhtml =~ s/MS-CMD2TRIGGER/$MSCMD2TRIGGER/g; + $triggerdetailhtml =~ s/MS-CMD1TRIGGER/$MSCMD1TRIGGER/g; + $triggerdetailhtml =~ s/MS-SAVEEVENT/$MSSAVEEVENT/g; + $triggerdetailhtml =~ s/MS-TRIGGER/$MSTRIGGER/g; + $triggerdetailhtml =~ s/MS-ADDEVENT/$MSADDEVENT/g; + $triggerdetailhtml =~ s/MS-MODLINE/$MSMODLINE/g; + $triggerdetailhtml =~ s/MS-TESTEVENT/$MSTESTEVENT/g; + $triggerdetailhtml =~ s/MS-CHANGETEXT/$inhalt5/g; + $triggerdetailhtml =~ s/MS-HIDE1/$displayntog/g; + $triggerdetailhtml =~ s/MS-HIDE/$displaynot/g; + $triggerdetailhtml =~ s/MS-HELP5/$MSHELP5/g; + $triggerdetailhtml =~ s/MS-HELP6/$MSHELP6/g; + + + + foreach (@translate) +{ +my($wert1,$wert2) = split (/->/,$_); +$triggerdetailhtml =~ s/$wert1/$wert2/g; +} + + + $ret.="
".$triggerdetailhtml."

"; + + +################################################################# + + + # id event bridge my $expertmode = AttrVal( $Name, 'MSwitch_Expert', '0' ); my $idmode = AttrVal( $Name, 'MSwitch_Event_Id_Distributor', 'undef' ); @@ -5852,13 +6484,13 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) $ret .= " - + "; my $toid = $hash->{helper}{eventtoid}; foreach my $a ( keys %{$toid} ) { - $ret .="
Event to ID distributor (Settings via attribute):
$MSDISTRIBUTORTEXT
 
    incommming Event: " + $ret .="
    $MSDISTRIBUTOREVENT " . $a . " =\> execute " . $hash->{helper}{eventtoid}{$a} @@ -5866,9 +6498,10 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) } $ret .= "
 

"; } +############################################################### + #auswfirst MSwitch_Selftrigger_always - my $style = ""; if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) eq "Dummy" && AttrVal( $Name, 'MSwitch_Selftrigger_always', '0' ) ne "1") { @@ -5882,63 +6515,112 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) "; } + + +my $MSSAVED=""; +my $MSSELECT=""; +my $MSHELP=""; +my $MSEDIT=""; +my $MSLOCK=""; +my $MSMOD=""; +my $selectaffectedhtml=" + + + + + + + + + + + + + + + + + + + + +
affected devices
MS-SAVED
 
MS-HELP multiple selection with ctrl and mousebuttonMS-SELECT
MS-EDIT
MS-LOCK
MS-MOD  
+"; +my $extrakt3 = $selectaffectedhtml; + + $extrakt3 =~ s/\n/#/g; + if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + $extrakt3 =~m/start:textersetzung:ger(.*)end:textersetzung:ger/ ; + $extrakt3 = $1; + } + else + { + $extrakt3 =~m/start:textersetzung:eng(.*)end:textersetzung:eng/ ; + $extrakt3 = $1; + } + + @translate=""; + if(defined $extrakt3) + { + $extrakt3 =~ s/^.//; + $extrakt3 =~ s/.$//; + @translate = split(/#/,$extrakt3); + } + if ( $hash->{INIT} ne 'define' ) { # affected devices class='block wide' style ='visibility: collapse' - $ret .=" - - - - - - - - - - - - - - - - - - - - -
affected devices : - "; if ( $savecmds ne "nosave" && $cmdfrombase eq "1" ) { - $ret .="
(all devicecomands saved )"; - } - $ret .= " -
- -
"; - + $MSSAVED="all devicecomands saved "; + } if ( AttrVal( $Name, 'MSwitch_Help', "0" ) eq '1' ) { - $ret .=" "; - } - - $ret .= "multiple selection with ctrl + mousebutton

- -

-
- -
- quickedit locked -
-
-
- -   
"; + $MSHELP=""; + } + + $MSSELECT =""; + $MSEDIT=""; + $MSLOCK=" quickedit locked"; + $MSMOD=""; } +$selectaffectedhtml =~ s/MS-SAVED/$MSSAVED/g; +$selectaffectedhtml =~ s/MS-SELECT/$MSSELECT/g; +$selectaffectedhtml =~ s/MS-HELP/$MSHELP/g; +$selectaffectedhtml =~ s/MS-EDIT/$MSEDIT/g; +$selectaffectedhtml =~ s/MS-LOCK/$MSLOCK/g; +$selectaffectedhtml =~ s/MS-MOD/$MSMOD/g; + +foreach (@translate) +{ +my($wert1,$wert2) = split (/->/,$_); +$selectaffectedhtml =~ s/$wert1/$wert2/g; +} +$selectaffectedhtml=~ s/#/\n/g; +$ret.="
". + $selectaffectedhtml. + "
"; + + + + + #################### #javascript$jsvarset my $triggerdevicehtml = $Triggerdevice; @@ -5981,6 +6663,10 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' ) sel3 = 'cmdsetoff' + devices[i]; aktcmd = document.getElementById(sel).value; aktset = document.getElementById(sel3).value; + + //alert(sel1); + //activate(document.getElementById(sel).value,sel1,aktset,sel2); + activate(document.getElementById(sel).value,sel1,aktset,sel2); };" } @@ -6327,7 +7013,7 @@ if ( AttrVal( $Name, 'MSwitch_Mode', 'Notify' ) ne "Dummy" ) // event = \"test:test:test\"; if (selected == '') { - var textfinal = \"
Es ist keine Bedingung definiert, das Kommando wird immer ausgeführt.
\"; + var textfinal = \"
".$NOCONDITION."
\"; FW_okDialog(textfinal); return; } @@ -6482,7 +7168,7 @@ Increase function slider(first,step,last,target,copytofield){ var selected =document.getElementById(copytofield).value; - var selectfield = \" 
   \" + first +\"\" + last ; + var selectfield = \"   \" + first +\"\" + last ; document.getElementById(target).innerHTML = selectfield + '
'; var opt = target + '_opt'; document.getElementById(opt).value=selected; @@ -6504,7 +7190,7 @@ Increase var selected =document.getElementById(copytofield).value; if (copytofield.indexOf('cmdonopt') != -1) { - var selectfield = \" 
\" ; + var selectfield = \"\" ; document.getElementById(target).innerHTML = selectfield + '
'; } else{ @@ -6764,12 +7450,34 @@ Increase function switchlock(){ test = document.getElementById('lockedit').checked ; if (test){ - \$(\"#devices\").prop(\"disabled\", 'disabled'); - document.getElementById('aw_great').value='edit list'; + \$(\"#devices\").prop(\"disabled\", 'disabled');"; + + + if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + $j1.="document.getElementById('aw_great').value='Liste editieren';"; } else{ - \$(\"#devices\").prop(\"disabled\", false); - document.getElementById('aw_great').value='schow greater list'; + $j1.="document.getElementById('aw_great').value='edit list';"; + } + + + + $j1.="} + else{ + \$(\"#devices\").prop(\"disabled\", false);"; + +if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE") + { + + $j1.="document.getElementById('aw_great').value='öffne grosse Liste';"; + } + else + { + $j1.="document.getElementById('aw_great').value='schow greater list';"; + } + + $j1.=" } } @@ -7256,7 +7964,7 @@ sub MSwitch_Exec_Notif($$$$$) { && $devicedetails{ $device . '_repeattime' } > 0 ) { my $i; - for ( $i = 1; + for ( $i = 1 ; $i <= $devicedetails{ $device . '_repeatcount' } ; $i++ ) { @@ -8834,12 +9542,14 @@ sub MSwitch_Createtimer($) { my $part1 = $1; my $part3 = $3; - if ($debugging eq "1") - { - MSwitch_LOG( "Debug", 0,"eveal line" . __LINE__ ); - } - + # if ($debugging eq "1") + #{ + #MSwitch_LOG( "Debug", 0,"eval line" . __LINE__ ); + #} +#MSwitch_LOG( "Debug", 0,"2: $2" . __LINE__ ); my $part2 = eval $2; +# MSwitch_LOG( "Debug", 0,"part2: $part2" . __LINE__ ); + if ( $part2 !~ m/^[0-9]{2}:[0-9]{2}$|^[0-9]{2}:[0-9]{2}:[0-9]{2}$/ ) { MSwitch_LOG( @@ -8854,6 +9564,8 @@ sub MSwitch_Createtimer($) { my $test = substr( $part2, 0, 2 ) * 1; $part2 = "" if $test > 23; $condition = $part1 . $part2 . $part3; + + } }