98_MSwitch.pm:Fix - change initial MODEL ( Full to Notify )

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18125 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Byte09 2019-01-03 10:15:46 +00:00
parent b2ab602caa
commit fb26a1b343

View File

@ -95,7 +95,8 @@ my $eventset = '0';
# standartlist ignorierter Devices . kann durch attribut überschrieben werden . # standartlist ignorierter Devices . kann durch attribut überschrieben werden .
my @doignore = my @doignore =
qw(notify allowed at watchdog doif fhem2fhem telnet FileLog readingsGroup FHEMWEB autocreate eventtypes readingsproxy svg cul); qw(notify allowed at watchdog doif fhem2fhem telnet FileLog readingsGroup FHEMWEB autocreate eventtypes readingsproxy svg cul);
my $startmode = "Notify";
# Startmodus des Devices nach Define
##################### ############################################ ##################### ############################################
sub MSwitch_Checkcond_time($$); sub MSwitch_Checkcond_time($$);
@ -472,6 +473,7 @@ sub MSwitch_LoadHelper($) {
my $devhash = undef; my $devhash = undef;
my $cdev = ''; my $cdev = '';
my $ctrigg = ''; my $ctrigg = '';
if ( defined $hash->{DEF} ) { if ( defined $hash->{DEF} ) {
$devhash = $hash->{DEF}; $devhash = $hash->{DEF};
@ -484,15 +486,20 @@ sub MSwitch_LoadHelper($) {
else { else {
$ctrigg = ''; $ctrigg = '';
} }
if ( defined $devhash ) { if ( defined $devhash )
{
$hash->{NOTIFYDEV} = $cdev; # stand aug global ... änderung auf ... $hash->{NOTIFYDEV} = $cdev; # stand aug global ... änderung auf ...
readingsSingleUpdate( $hash, "Trigger_device", $cdev, 0 ); #readingsSingleUpdate( $hash, "Trigger_device", $cdev, 0 );
if ( defined $cdev && $cdev ne '' ) { if ( defined $cdev && $cdev ne '' )
{
#MSwitch_LOG( $Name, 0, "$Name Triggerdevice cdev - $cdev " . __LINE__ );
readingsSingleUpdate( $hash, "Trigger_device", $cdev, 0 ); readingsSingleUpdate( $hash, "Trigger_device", $cdev, 0 );
} }
} }
else { else
{
$hash->{NOTIFYDEV} = 'no_trigger'; $hash->{NOTIFYDEV} = 'no_trigger';
#MSwitch_LOG( $Name, 0, "$Name update Triggerdevice " . __LINE__ );
readingsSingleUpdate( $hash, "Trigger_device", 'no_trigger', 0 ); readingsSingleUpdate( $hash, "Trigger_device", 'no_trigger', 0 );
} }
} }
@ -506,6 +513,7 @@ sub MSwitch_LoadHelper($) {
if ( $oldtrigger ne 'undef' ) { if ( $oldtrigger ne 'undef' ) {
$hash->{NOTIFYDEV} = $oldtrigger; $hash->{NOTIFYDEV} = $oldtrigger;
#MSwitch_LOG( $Name, 0, "$Name update oldtrigger - $oldtrigger " . __LINE__ );
readingsSingleUpdate( $hash, "Trigger_device", $oldtrigger, 0 ); readingsSingleUpdate( $hash, "Trigger_device", $oldtrigger, 0 );
} }
@ -570,7 +578,7 @@ sub MSwitch_LoadHelper($) {
$attr{$Name}{MSwitch_Include_MSwitchcmds} = '0'; $attr{$Name}{MSwitch_Include_MSwitchcmds} = '0';
$attr{$Name}{MSwitch_Lock_Quickedit} = '1'; $attr{$Name}{MSwitch_Lock_Quickedit} = '1';
$attr{$Name}{MSwitch_Extensions} = '0'; $attr{$Name}{MSwitch_Extensions} = '0';
$attr{$Name}{MSwitch_Mode} = 'Full'; $attr{$Name}{MSwitch_Mode} = $startmode;
} }
# NEU; ZUVOR IN SET # NEU; ZUVOR IN SET
@ -600,7 +608,7 @@ sub MSwitch_Define($$) {
$hash->{Version_Modul} = $version; $hash->{Version_Modul} = $version;
$hash->{Version_Datenstruktur} = $vupdate; $hash->{Version_Datenstruktur} = $vupdate;
$hash->{Version_autoupdate} = $autoupdate; $hash->{Version_autoupdate} = $autoupdate;
$hash->{MODEL} = 'Full'; $hash->{MODEL} = $startmode;
if ( $init_done && !defined( $hash->{OLDDEF} ) ) { if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
my $timecond = gettimeofday() + 5; my $timecond = gettimeofday() + 5;