diff --git a/fhem/FHEM/98_MSwitch.pm b/fhem/FHEM/98_MSwitch.pm
index 7278779ac..b1b4a37f1 100644
--- a/fhem/FHEM/98_MSwitch.pm
+++ b/fhem/FHEM/98_MSwitch.pm
@@ -25,8 +25,6 @@
#
#################################################################
# Todo's:
-# reading last_cmd fehlerhaft bei befehlen mit delay - fixed
-# del delays kontrollieren - fixed
#---------------------------------------------------------------
#
# info sonderreadings
@@ -49,17 +47,11 @@
#################################################################
-
-
-
-
-
package main;
use Time::Local;
use strict;
use warnings;
use POSIX;
-
use SetExtensions;
# Version #######################################################
@@ -269,11 +261,7 @@ sub MSwitch_Initialize($) {
. $readingFnAttributes;
$hash->{FW_addDetailToSummary} = 0;
-
-
-
- #. " MSwitch_Develop_Affected:textField-long"
- #. " MSwitch_Develop_Trigger:textField-long"
+
}
####################
sub MSwitch_Rename($) {
@@ -282,8 +270,6 @@ sub MSwitch_Rename($) {
my ( $new_name, $old_name ) = @_;
my $hash_new = $defs{$new_name};
-
-
my $hashold = $defs{$new_name}{$old_name};
RemoveInternalTimer($hashold);
Log3( $old_name, 0, "clear rename ! $old_name $new_name" );
@@ -294,9 +280,7 @@ sub MSwitch_Rename($) {
RemoveInternalTimer($key);
}
delete( $hashold->{helper}{repeats} );
-
-
-
+
RemoveInternalTimer($hash_new);
Log3( $old_name, 0, "clear rename ! $old_name $new_name" );
my $inhalt1 = $hash_new->{helper}{repeats};
@@ -307,16 +291,8 @@ sub MSwitch_Rename($) {
}
delete( $hash_new->{helper}{repeats} );
delete( $modules{MSwitch}{defptr}{$old_name} );
-
-
$modules{MSwitch}{defptr}{$new_name} = $hash_new;
- #MSwitch_Createtimer($hash_new);
return undef;
-
-
-
-
-
}
#####################################
sub MSwitch_Shutdown($) {
@@ -561,20 +537,13 @@ sub MSwitch_check_init($) {
my $Name = $hash->{NAME};
Log3( $Name, 5, "start checkinit !" );#LOG
my $oldtrigger = ReadingsVal( $Name, 'Trigger_device', 'undef' );
- #Log3( $Name, 0, "start checkinit ! oldtrigger: ".$oldtrigger );#LOG
- #Log3( $Name, 0, "start checkinit ! NOTIFYDEF ".$hash->{NOTIFYDEV} );#LOG
- #if ( $oldtrigger ne 'undef' && $hash->{NOTIFYDEV} ne $oldtrigger)
if ( $oldtrigger ne 'undef')
{
$hash->{NOTIFYDEV} = $oldtrigger;
readingsSingleUpdate( $hash, "Trigger_device", $oldtrigger, 0 );
}
- #else{
- #$hash->{NOTIFYDEV} = 'no_trigger';
- #}
}
-
####################
sub MSwitch_LoadHelper($) {
my ($hash) = @_;
@@ -583,9 +552,6 @@ sub MSwitch_LoadHelper($) {
my $devhash = undef;
my $cdev = '';
my $ctrigg = '';
-
- #Log3( $Name, 0, "start Loadhelper $Name !" );#LOG
-
if ( $hash->{INIT} eq "def" )
{
return;
@@ -767,15 +733,8 @@ sub MSwitch_Define($$) {
{
$hash->{INIT} = 'fhem.save';
}
-
-#Log3( $name, 5, "start checkinitdone ".$init_done );#LOG
-
-
if ( $init_done && !defined( $hash->{OLDDEF} ) )
- #if ( $init_done )
{
- ## prüfe NOTIFYDEF
- #Log3( $name, 0, "start checkinitdone wird ausgeführt ".$init_done );#LOG
my $timecond = gettimeofday() + 5;
InternalTimer( $timecond, "MSwitch_check_init", $hash );
}
@@ -891,9 +850,6 @@ sub MSwitch_Get($$@) {
return $ret;
}
####################
-
-
-
my $KLAMMERFEHLER;
my $CONDTRUE;
my $CONDTRUE1;
@@ -944,19 +900,6 @@ if (AttrVal( $name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) e
$SYSTEMZEIT="system time:";
$SCHALTZEIT="Switching times (at - commands)";
}
-
-
-
-
-
-
-
-
-
-
-
-
-
if ( $opt eq 'MSwitch_preconf' )
{
@@ -1247,15 +1190,6 @@ sub MSwitch_AsyncOutput ($) {
sub MSwitch_Set($@) {
my ( $hash, $name, $cmd, @args ) = @_;
MSwitch_LOG( $name, 5, "$name Set $cmd, @args " . __LINE__ );
-
- #if ( ReadingsVal( $name, '.First_init', 'undef' ) ne 'done' )
- #{
- # unvollständige daten ergänzen
- #Log3( $name, 0, "starte helper aus set " );#LOG
- #Log3( $name, 0, "starte helper aus set " );#LOG
- #MSwitch_LoadHelper($hash);
- #}
-
#lösche saveddevicecmd
MSwitch_del_savedcmds($hash);
return "" if ( IsDisabled($name) && ( $cmd eq 'on' || $cmd eq 'off' ) );# Return without any further action if the module is disabled
@@ -1316,7 +1250,6 @@ sub MSwitch_Set($@) {
MSwitch_Check_Event( $hash, "MSwitch_self:".$cmd.":".$args[0] ) if defined $setlist{$cmd};
}
-
my %setlist;
if ( !defined $args[0] ) { $args[0] = ''; }
@@ -2209,17 +2142,13 @@ my %setlist;
return;
}
- ##################################################################
+ ##################################
my $update = '';
# unbedingt überarbeiten !!!
my @testdetails =qw(_on _off _onarg _offarg _playback _record _timeon _timeoff _conditionon _conditionoff);
my @testdetailsstandart =( 'no_action', 'no_action', '', '', 'nein', 'nein', 0, 0, '', '' );
##################################
-######################################################################
-
-
-
#neu ausführung on/off
if ( $cmd eq "off" || $cmd eq "on" )
{
@@ -2245,8 +2174,7 @@ my %setlist;
}
###################################################
-
-
+
### neu
if ( $delaymode eq '1' )
{
@@ -2865,10 +2793,6 @@ sub MSwitch_Attr(@) {
. " textField-long ";
setDevAttrList($name, $attrzerolist);
-
-
- #. " MSwitch_Develop_Affected:textField-long"
- #. " MSwitch_Develop_Trigger:textField-long"
}
if ( $aName eq 'MSwitch_Mode' && $aVal eq 'Notify' )
@@ -3335,18 +3259,15 @@ delete( $own_hash->{helper}{history} );# lösche historyberechnung verschieben a
if ( $triggerdevice eq "all_events" )
{
$own_hash->{helper}{events}{'all_events'}{ $devName . ':' . $eventcopy } = "on";
- #$own_hash->{helper}{eventlog}{$zeit}=$devName . ':' . $eventcopy ;
}
else
{
$own_hash->{helper}{events}{$devName}{$eventcopy} = "on";
- #$own_hash->{helper}{eventlog}{$zeit}=$devName . ':' . $eventcopy;
}
}
else
{
$own_hash->{helper}{events}{MSwitch_Self}{$eventcopy} = "on";
- #$own_hash->{helper}{eventlog}{$zeit}="MSitch_Self:". $eventcopy;
}
}
@@ -3411,7 +3332,6 @@ delete( $own_hash->{helper}{history} );# lösche historyberechnung verschieben a
if ( AttrVal( $ownName, "MSwitch_Selftrigger_always", 0 ) eq "1" && $incommingdevice eq "MSwitch_Self")
{
$eventcopy1 = "MSwitch_Self:$eventcopy";
- #Log3( $ownName, 0, $ownName." eventcopy1 : ".$eventcopy1 );
$eventcopy = $eventcopy1;
}
@@ -3421,7 +3341,6 @@ delete( $own_hash->{helper}{history} );# lösche historyberechnung verschieben a
my $testvar = '';
my $check = 0;
-#if ( $devicemode ne "Dummy") {
#test auf zweige cmd1/2 and switch MSwitch on/off
if ( $triggeron ne 'no_trigger' )
{
@@ -3513,7 +3432,7 @@ delete( $own_hash->{helper}{history} );# lösche historyberechnung verschieben a
$check = 1;
$foundcmd1 = 1;
}
- }
+ }
# speichert 20 events ab zur weiterne funktion ( funktionen )
# ändern auf bedarfschaltung
@@ -3822,7 +3741,7 @@ my $EXECCMD;
if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) eq "DE")
{
- $MSDISTRIBUTORTEXT="Event zu ID Verteilung (einstellung über Attribut)";
+ $MSDISTRIBUTORTEXT="Zuordnung Event/ID (einstellung über Attribut)";
$MSDISTRIBUTOREVENT="eingehendes Event";
$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 !";
@@ -3864,24 +3783,12 @@ if (AttrVal( $Name, 'MSwitch_Language',AttrVal( 'global', 'language', 'EN' ) ) e
####################
-
-
-
-
-
-
-
# lösche saveddevicecmd #
-
if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )
{
MSwitch_LoadHelper($hash);
}
-
-
-
-
my $cmdfrombase = "0";
MSwitch_del_savedcmds($hash);
@@ -4189,16 +4096,16 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )
#########################################
# SHOW
# teste auf grössere PRIORITY als anzahl devices
- # foreach (@testidsdev)
- # {
- # MSwitch_LOG( $Name, 5, "dev @testidsdev" );
- # my @testid = split( /#\[NF\]/, $_ );
- # my $x = 0;
- # MSwitch_LOG( $Name, 5, "devfelder @testid" );
- # my $id = $testid[18];
- # MSwitch_LOG( $Name, 5, "id $id" );
- # $anzahl1 = $id if $id > $anzahl;
- # }
+ foreach (@testidsdev)
+ {
+ MSwitch_LOG( $Name, 5, "dev @testidsdev" );
+ my @testid = split( /#\[NF\]/, $_ );
+ my $x = 0;
+ MSwitch_LOG( $Name, 5, "devfelder @testid" );
+ my $id = $testid[18];
+ MSwitch_LOG( $Name, 5, "id $id" );
+ $anzahl1 = $id if $id > $anzahl;
+ }
#################################
my $showfolgehtml = "";
@@ -4365,18 +4272,7 @@ if ( ReadingsVal( $Name, '.First_init', 'undef' ) ne 'done' )
{
$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;
$errors =~ s/\|//g;
@@ -4777,13 +4673,9 @@ MS-HELPdelay
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 %savedetails = MSwitch_makeCmdHash($Name);
@@ -4853,9 +4745,7 @@ $controlhtml=~ s/#/\n/g;
$HELPexeccmd="";
$HELPdelay="";
}
-
-
if ( $affecteddevices[0] ne 'no_device' )
{
####################### sortierungsblock
@@ -4902,14 +4792,10 @@ $controlhtml=~ s/#/\n/g;
";
-
##########################
# $detailhtml .= $sortierung;
##########################
- #my $detailhtmlold;
-
-
my $alert;
foreach (@affecteddevices)
{
@@ -5183,20 +5069,6 @@ $controlhtml=~ s/#/\n/g;
. $savedetails{ $aktdevice . '_comment' }
. "";
}
-
-
- # 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 ( $devicenamet ne 'FreeCmd' )
{
@@ -5234,13 +5106,11 @@ $controlhtml=~ s/#/\n/g;