mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 05:16:45 +00:00
98_MSwitch.pm:Update -> V2.93
git-svn-id: https://svn.fhem.de/fhem/trunk@20788 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
12bcb474a6
commit
a3de49873d
@ -81,7 +81,7 @@ if ( $preconf && $preconf ne "" ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $autoupdate = 'off'; #off/on
|
my $autoupdate = 'off'; #off/on
|
||||||
my $version = '2.92';
|
my $version = '2.93';
|
||||||
my $vupdate = 'V2.00'; # versionsnummer der datenstruktur . änderung der nummer löst MSwitch_VUpdate aus .
|
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 $savecount = 30; # anzahl der zugriff im zeitraum zur auslösung des safemodes. kann durch attribut überschrieben werden .
|
||||||
my $standartstartdelay = 30; # zeitraum nach fhemstart , in dem alle aktionen geblockt werden. kann durch attribut überschrieben werden .
|
my $standartstartdelay = 30; # zeitraum nach fhemstart , in dem alle aktionen geblockt werden. kann durch attribut überschrieben werden .
|
||||||
@ -226,6 +226,7 @@ sub MSwitch_Initialize($) {
|
|||||||
. " stateFormat:textField-long"
|
. " stateFormat:textField-long"
|
||||||
. " MSwitch_Comments:0,1"
|
. " MSwitch_Comments:0,1"
|
||||||
. " MSwitch_Read_Log:0,1"
|
. " MSwitch_Read_Log:0,1"
|
||||||
|
. " MSwitch_Hidecmds"
|
||||||
. " MSwitch_Help:0,1"
|
. " MSwitch_Help:0,1"
|
||||||
. " MSwitch_Debug:0,1,2,3,4"
|
. " MSwitch_Debug:0,1,2,3,4"
|
||||||
. " MSwitch_Expert:0,1"
|
. " MSwitch_Expert:0,1"
|
||||||
@ -1459,6 +1460,7 @@ my %setlist;
|
|||||||
. " stateFormat:textField-long"
|
. " stateFormat:textField-long"
|
||||||
. " MSwitch_Comments:0,1"
|
. " MSwitch_Comments:0,1"
|
||||||
. " MSwitch_Read_Log:0,1"
|
. " MSwitch_Read_Log:0,1"
|
||||||
|
. " MSwitch_Hidecmds"
|
||||||
. " MSwitch_Help:0,1"
|
. " MSwitch_Help:0,1"
|
||||||
. " MSwitch_Debug:0,1,2,3,4"
|
. " MSwitch_Debug:0,1,2,3,4"
|
||||||
. " MSwitch_Expert:0,1"
|
. " MSwitch_Expert:0,1"
|
||||||
@ -2091,12 +2093,27 @@ my %setlist;
|
|||||||
# show
|
# show
|
||||||
if ( defined $devicecmds[17] && $devicecmds[17] ne 'undefined' )
|
if ( defined $devicecmds[17] && $devicecmds[17] ne 'undefined' )
|
||||||
{
|
{
|
||||||
$savedetails = $savedetails . $devicecmds[17] . '#[ND]';
|
$savedetails = $savedetails . $devicecmds[17] . '#[NF]';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$savedetails = $savedetails . '1' . '#[ND]';
|
$savedetails = $savedetails . '1' . '#[NF]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# show
|
||||||
|
if ( defined $devicecmds[18] && $devicecmds[18] ne 'undefined' )
|
||||||
|
{
|
||||||
|
$savedetails = $savedetails . $devicecmds[18] . '#[ND]';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$savedetails = $savedetails . '0' . '#[ND]';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# $counter++;
|
# $counter++;
|
||||||
}
|
}
|
||||||
chop($savedetails);
|
chop($savedetails);
|
||||||
@ -3779,7 +3796,9 @@ sub MSwitch_fhemwebFn($$$$) {
|
|||||||
my $ver = ReadingsVal( $Name, '.V_Check', '' );
|
my $ver = ReadingsVal( $Name, '.V_Check', '' );
|
||||||
|
|
||||||
my $expertmode = AttrVal( $Name, 'MSwitch_Expert', '0' );
|
my $expertmode = AttrVal( $Name, 'MSwitch_Expert', '0' );
|
||||||
|
my $noshow = 0;
|
||||||
|
my @hidecmds = split (/,/,AttrVal( $Name, 'MSwitch_Hidecmds', 'undef' )) ;
|
||||||
|
#<option value='$savedetails{ $aktdevice . '_priority'
|
||||||
##### test
|
##### test
|
||||||
|
|
||||||
#################### TEXTSPRACHE
|
#################### TEXTSPRACHE
|
||||||
@ -4142,6 +4161,7 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )
|
|||||||
my $anzahl1 = @deftoarray;
|
my $anzahl1 = @deftoarray;
|
||||||
my $anzahl3 = @deftoarray;
|
my $anzahl3 = @deftoarray;
|
||||||
my @testidsdev = split( /#\[ND\]/, ReadingsVal($Name, '.Device_Affected_Details', 'no_device' ) );
|
my @testidsdev = split( /#\[ND\]/, ReadingsVal($Name, '.Device_Affected_Details', 'no_device' ) );
|
||||||
|
|
||||||
#PRIORITY
|
#PRIORITY
|
||||||
# teste auf grössere PRIORITY als anzahl devices
|
# teste auf grössere PRIORITY als anzahl devices
|
||||||
foreach (@testidsdev)
|
foreach (@testidsdev)
|
||||||
@ -4168,6 +4188,12 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )
|
|||||||
$reihenfolgehtml .= "</select>";
|
$reihenfolgehtml .= "</select>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### display
|
||||||
|
my $hidehtml = "";
|
||||||
|
$hidehtml = "<select name = 'hidecmd' id=''>";
|
||||||
|
$hidehtml .= "<option value='0'>0</option>";
|
||||||
|
$hidehtml .= "<option value='1'>1</option>";
|
||||||
|
$hidehtml .= "</select>";
|
||||||
#########################################
|
#########################################
|
||||||
# SHOW
|
# SHOW
|
||||||
# teste auf grössere PRIORITY als anzahl devices
|
# teste auf grössere PRIORITY als anzahl devices
|
||||||
@ -4453,7 +4479,9 @@ MS-cellhigh=30;
|
|||||||
<!--
|
<!--
|
||||||
start:textersetzung:ger
|
start:textersetzung:ger
|
||||||
Set->Schaltbefehl
|
Set->Schaltbefehl
|
||||||
|
Hidden command branches are available->Ausgeblendete Befehlszweige vorhanden
|
||||||
condition:->Schaltbedingung
|
condition:->Schaltbedingung
|
||||||
|
show hidden cmds->ausgeblendete Befehlszweige anzeigen
|
||||||
execute and exit if applies->Abbruch nach Ausführung
|
execute and exit if applies->Abbruch nach Ausführung
|
||||||
Repeats:->Befehlswiederholungen:
|
Repeats:->Befehlswiederholungen:
|
||||||
Repeatdelay in sec:->Wiederholungsverzögerung in Sekunden:
|
Repeatdelay in sec:->Wiederholungsverzögerung in Sekunden:
|
||||||
@ -4470,7 +4498,8 @@ device actions sortby:->Sortierung:
|
|||||||
add action for->zusätzliche Aktion für
|
add action for->zusätzliche Aktion für
|
||||||
delete this action for->lösche diese Aktion für
|
delete this action for->lösche diese Aktion für
|
||||||
priority:->Priorität:
|
priority:->Priorität:
|
||||||
show:->Anzeigereihenfolge
|
displaysequence:->Anzeigereihenfolge:
|
||||||
|
display->Anzeige verbergen
|
||||||
test comand->Befehl testen
|
test comand->Befehl testen
|
||||||
end:textersetzung:ger
|
end:textersetzung:ger
|
||||||
-->
|
-->
|
||||||
@ -4908,8 +4937,6 @@ $controlhtml=~ s/#/\n/g;
|
|||||||
$savedetails{ $aktdevice . '_showreihe' } = '1';
|
$savedetails{ $aktdevice . '_showreihe' } = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$savedetails{ $aktdevice . '_onarg' } =~ s/#\[ti\]/~/g;
|
$savedetails{ $aktdevice . '_onarg' } =~ s/#\[ti\]/~/g;
|
||||||
$savedetails{ $aktdevice . '_offarg' } =~ s/#\[ti\]/~/g;
|
$savedetails{ $aktdevice . '_offarg' } =~ s/#\[ti\]/~/g;
|
||||||
$savedetails{ $aktdevice . '_onarg' } =~ s/#\[wa\]/|/g; #neu
|
$savedetails{ $aktdevice . '_onarg' } =~ s/#\[wa\]/|/g; #neu
|
||||||
@ -4951,7 +4978,6 @@ $controlhtml=~ s/#/\n/g;
|
|||||||
my $change ="<option selected value='$savedetails{ $aktdevice . '_priority' }'>$savedetails{ $aktdevice . '_priority' }</option>";
|
my $change ="<option selected value='$savedetails{ $aktdevice . '_priority' }'>$savedetails{ $aktdevice . '_priority' }</option>";
|
||||||
$aktfolge =~ s/reihe/$newname/g;
|
$aktfolge =~ s/reihe/$newname/g;
|
||||||
$aktfolge =~ s/$tochange/$change/g;
|
$aktfolge =~ s/$tochange/$change/g;
|
||||||
|
|
||||||
$IDsatz="priority: " . $aktfolge . " ";
|
$IDsatz="priority: " . $aktfolge . " ";
|
||||||
|
|
||||||
# ende
|
# ende
|
||||||
@ -4964,8 +4990,7 @@ $controlhtml=~ s/#/\n/g;
|
|||||||
$change ="<option selected value='$savedetails{ $aktdevice . '_showreihe' }'>$savedetails{ $aktdevice . '_showreihe' }</option>";
|
$change ="<option selected value='$savedetails{ $aktdevice . '_showreihe' }'>$savedetails{ $aktdevice . '_showreihe' }</option>";
|
||||||
$aktfolge =~ s/showreihe/$newname/g;
|
$aktfolge =~ s/showreihe/$newname/g;
|
||||||
$aktfolge =~ s/$tochange/$change/g;
|
$aktfolge =~ s/$tochange/$change/g;
|
||||||
|
$IDsatz.="displaysequence: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' );
|
||||||
$IDsatz.="show: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' );
|
|
||||||
####
|
####
|
||||||
# ID
|
# ID
|
||||||
$aktfolge = $idfolgehtml;
|
$aktfolge = $idfolgehtml;
|
||||||
@ -4974,10 +4999,17 @@ $controlhtml=~ s/#/\n/g;
|
|||||||
$change ="<option selected value='$savedetails{ $aktdevice . '_id' }'>$savedetails{ $aktdevice . '_id' }</option>";
|
$change ="<option selected value='$savedetails{ $aktdevice . '_id' }'>$savedetails{ $aktdevice . '_id' }</option>";
|
||||||
$aktfolge =~ s/idreihe/$newname/g;
|
$aktfolge =~ s/idreihe/$newname/g;
|
||||||
$aktfolge =~ s/$tochange/$change/g;
|
$aktfolge =~ s/$tochange/$change/g;
|
||||||
|
|
||||||
$IDsatz.="ID: " . $aktfolge;
|
$IDsatz.="ID: " . $aktfolge;
|
||||||
|
|
||||||
# ende
|
$aktfolge = $hidehtml;
|
||||||
|
$newname = "hidecmd" . $nopoint;
|
||||||
|
$tochange ="<option value='$savedetails{ $aktdevice . '_hidecmd' }'>";
|
||||||
|
$change ="<option selected value='$savedetails{ $aktdevice . '_hidecmd' }'>";
|
||||||
|
$aktfolge =~ s/hidecmd/$newname/g;
|
||||||
|
$aktfolge =~ s/$tochange/$change/g;
|
||||||
|
$IDsatz.="display: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' );
|
||||||
|
|
||||||
|
# ende
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4988,8 +5020,15 @@ $controlhtml=~ s/#/\n/g;
|
|||||||
my $change ="<option selected value='$savedetails{ $aktdevice . '_showreihe' }'>$savedetails{ $aktdevice . '_showreihe' }</option>";
|
my $change ="<option selected value='$savedetails{ $aktdevice . '_showreihe' }'>$savedetails{ $aktdevice . '_showreihe' }</option>";
|
||||||
$aktfolge =~ s/showreihe/$newname/g;
|
$aktfolge =~ s/showreihe/$newname/g;
|
||||||
$aktfolge =~ s/$tochange/$change/g;
|
$aktfolge =~ s/$tochange/$change/g;
|
||||||
|
$IDsatz.= "displaysequence: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' );
|
||||||
|
|
||||||
$IDsatz.= "show : " . $aktfolge . " " if ( $hash->{INIT} ne 'define' );
|
$aktfolge = $hidehtml;
|
||||||
|
$newname = "hidecmd" . $nopoint;
|
||||||
|
$tochange ="<option value='$savedetails{ $aktdevice . '_hidecmd' }'>";
|
||||||
|
$change ="<option selected value='$savedetails{ $aktdevice . '_hidecmd' }'>";
|
||||||
|
$aktfolge =~ s/hidecmd/$newname/g;
|
||||||
|
$aktfolge =~ s/$tochange/$change/g;
|
||||||
|
$IDsatz.="display: " . $aktfolge . " " if ( $hash->{INIT} ne 'define' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5241,9 +5280,6 @@ $COND1check1="<input name='info' type='button' value='check condition' onclick=\
|
|||||||
. "</select>";
|
. "</select>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### zeitrechner ABSATZ UAF NOTWENDIGKEIT PRÜF
|
#### zeitrechner ABSATZ UAF NOTWENDIGKEIT PRÜF
|
||||||
my $delaym = 0;
|
my $delaym = 0;
|
||||||
my $delays = 0;
|
my $delays = 0;
|
||||||
@ -5256,8 +5292,6 @@ $COND1check1="<input name='info' type='button' value='check condition' onclick=\
|
|||||||
$timestron=$savedetails{ $aktdevice . '_timeon' };
|
$timestron=$savedetails{ $aktdevice . '_timeon' };
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$DELAYset1= "<select id = '' name='onatdelay". $nopoint . "'>";
|
$DELAYset1= "<select id = '' name='onatdelay". $nopoint . "'>";
|
||||||
|
|
||||||
my $se11 = '';
|
my $se11 = '';
|
||||||
@ -5428,10 +5462,39 @@ foreach (@translate)
|
|||||||
my($wert1,$wert2) = split (/->/,$_);
|
my($wert1,$wert2) = split (/->/,$_);
|
||||||
$controlhtmldevice =~ s/$wert1/$wert2/g;
|
$controlhtmldevice =~ s/$wert1/$wert2/g;
|
||||||
}
|
}
|
||||||
$detailhtml.= "<div id='MSwitchWebTR' nm='$hash->{NAME}' cellpadding='0' style='border-spacing:0px;'>".
|
|
||||||
|
my $aktpriority=$savedetails{ $aktdevice . '_showreihe'};
|
||||||
|
if ( grep { $_ eq $aktpriority } @hidecmds)
|
||||||
|
{
|
||||||
|
$noshow++;
|
||||||
|
$detailhtml.= "<div id='MSwitchWebTR' nm='$hash->{NAME}' name ='noshow' cellpadding='0' style='display: none;border-spacing:0px;'>".
|
||||||
$controlhtmldevice.
|
$controlhtmldevice.
|
||||||
"</div>";
|
"</div>";
|
||||||
#####
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if( $savedetails{ $aktdevice . '_hidecmd' } eq "1")
|
||||||
|
{
|
||||||
|
$noshow++;
|
||||||
|
$detailhtml.= "<div id='MSwitchWebTR' nm='$hash->{NAME}' name ='noshow' cellpadding='0' style='display: none;border-spacing:0px;'>".
|
||||||
|
$controlhtmldevice.
|
||||||
|
"</div>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$detailhtml.= "<div id='MSwitchWebTR' nm='$hash->{NAME}' cellpadding='0' style='border-spacing:0px;'>".
|
||||||
|
$controlhtmldevice.
|
||||||
|
"</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# javazeile für übergabe erzeugen
|
# javazeile für übergabe erzeugen
|
||||||
$javaform = $javaform . "
|
$javaform = $javaform . "
|
||||||
devices += \$(\"[name=devicename$nopoint]\").val();
|
devices += \$(\"[name=devicename$nopoint]\").val();
|
||||||
@ -5474,11 +5537,30 @@ $controlhtmldevice =~ s/$wert1/$wert2/g;
|
|||||||
devices += \$(\"[name=exit2$nopoint]\").prop(\"checked\") ? \"1\":\"0\";
|
devices += \$(\"[name=exit2$nopoint]\").prop(\"checked\") ? \"1\":\"0\";
|
||||||
devices += '#[NF]';
|
devices += '#[NF]';
|
||||||
devices += \$(\"[name=showreihe$nopoint]\").val();
|
devices += \$(\"[name=showreihe$nopoint]\").val();
|
||||||
|
devices += '#[NF]';
|
||||||
|
devices += \$(\"[name=hidecmd$nopoint]\").val();
|
||||||
devices += '#[DN]';
|
devices += '#[DN]';
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
# textersetzung modify
|
# textersetzung modify
|
||||||
|
|
||||||
|
|
||||||
|
if ($noshow > 0)
|
||||||
|
{
|
||||||
|
$modify ="<table width = '100%' border='0' class='block wide' name ='noshowtask' id='MSwitchDetails' cellpadding='4' style='border-spacing:0px;' nm='MSwitch'>
|
||||||
|
<tr class='even'><td><br>
|
||||||
|
Hidden command branches are available ($noshow)
|
||||||
|
|
||||||
|
<input type='button' id='aw_show' value='show hidden cmds' >
|
||||||
|
|
||||||
|
<br>
|
||||||
|
</td></tr></table><br>
|
||||||
|
".$modify;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (@translate)
|
foreach (@translate)
|
||||||
{
|
{
|
||||||
my($wert1,$wert2) = split (/->/,$_);
|
my($wert1,$wert2) = split (/->/,$_);
|
||||||
@ -5522,8 +5604,6 @@ $detailhtml .= $modify;
|
|||||||
|
|
||||||
my $ret = '';
|
my $ret = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
my $blocking = '';
|
my $blocking = '';
|
||||||
$blocking = $hash->{helper}{savemodeblock}{blocking} if ( defined $hash->{helper}{savemodeblock}{blocking} );
|
$blocking = $hash->{helper}{savemodeblock}{blocking} if ( defined $hash->{helper}{savemodeblock}{blocking} );
|
||||||
@ -7351,17 +7431,36 @@ Increase
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
\$(\"#aw_show\").click(function(){
|
||||||
|
//alert('test');
|
||||||
|
|
||||||
|
\$(\"[name=noshow]\").css(\"display\",\"block\");
|
||||||
|
\$(\"[name=noshowtask]\").css(\"display\",\"none\");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\$(\"#aw_det\").click(function(){
|
\$(\"#aw_det\").click(function(){
|
||||||
var nm = \$(t).attr(\"nm\");
|
var nm = \$(t).attr(\"nm\");
|
||||||
devices = '';
|
devices = '';
|
||||||
$javaform
|
$javaform
|
||||||
|
|
||||||
|
//alert(devices);
|
||||||
|
//return;
|
||||||
|
|
||||||
|
|
||||||
devices = devices.replace(/:/g,'#[dp]');
|
devices = devices.replace(/:/g,'#[dp]');
|
||||||
devices = devices.replace(/;/g,'#[se]');
|
devices = devices.replace(/;/g,'#[se]');
|
||||||
devices = devices.replace(/ /g,'#[sp]');
|
devices = devices.replace(/ /g,'#[sp]');
|
||||||
devices = devices.replace(/%/g,'#[pr]');
|
devices = devices.replace(/%/g,'#[pr]');
|
||||||
devices = encodeURIComponent(devices);
|
devices = encodeURIComponent(devices);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var def = nm+\" details \"+devices+\" \";
|
var def = nm+\" details \"+devices+\" \";
|
||||||
location = location.pathname+\"?detail=" . $Name . "&cmd=set \"+addcsrf(def);
|
location = location.pathname+\"?detail=" . $Name . "&cmd=set \"+addcsrf(def);
|
||||||
});
|
});
|
||||||
@ -7626,6 +7725,22 @@ sub MSwitch_makeCmdHash($) {
|
|||||||
}
|
}
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
||||||
|
$key = $detailarray[0] . "_hidecmd";
|
||||||
|
if ( defined $detailarray[19] )
|
||||||
|
{
|
||||||
|
$savedetails{$key} = $detailarray[19];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$savedetails{$key} = 0;
|
||||||
|
}
|
||||||
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$key = $detailarray[0] . "_comment";
|
$key = $detailarray[0] . "_comment";
|
||||||
if ( defined $detailarray[15] )
|
if ( defined $detailarray[15] )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user