From 774fe63a261fe9b1a6cff1dbd6326bd4b48fcce3 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 08:38:31 +0200 Subject: [PATCH 1/7] add remove DelayTimer or set new then new rain protection trigger --- controls_AutoShuttersControl.txt | 12 +-- .../ShuttersControl/Rainprotection.pm | 6 ++ .../Automation/ShuttersControl/Shutters.pm | 80 +++++++++++-------- 3 files changed, 59 insertions(+), 39 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 16f7a89..5824cda 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -1,10 +1,10 @@ -UPD 2021-05-17_14:25:13 97974 FHEM/73_AutoShuttersControl.pm -UPD 2021-05-17_14:25:13 74350 lib/FHEM/Automation/ShuttersControl.pm +UPD 2021-05-17_14:30:37 97974 FHEM/73_AutoShuttersControl.pm +UPD 2021-05-17_14:34:49 74350 lib/FHEM/Automation/ShuttersControl.pm UPD 2020-06-22_09:41:40 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2020-07-26_17:36:29 2496 lib/FHEM/Automation/ShuttersControl/Roommate.pm -UPD 2021-02-26_14:36:10 31487 lib/FHEM/Automation/ShuttersControl/Shutters.pm -UPD 2021-05-10_08:26:03 25329 lib/FHEM/Automation/ShuttersControl/Shading.pm -UPD 2021-05-17_14:26:04 108472 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm +UPD 2021-05-18_08:26:00 32241 lib/FHEM/Automation/ShuttersControl/Shutters.pm +UPD 2021-05-17_14:30:37 25329 lib/FHEM/Automation/ShuttersControl/Shading.pm +UPD 2021-05-17_14:34:49 108472 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm UPD 2021-02-26_14:36:10 40628 lib/FHEM/Automation/ShuttersControl/Helper.pm UPD 2020-06-22_09:41:40 2175 lib/FHEM/Automation/ShuttersControl/Window.pm UPD 2021-04-27_07:52:31 11742 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm @@ -13,4 +13,4 @@ UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr. UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-17_14:26:04 5159 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_08:38:16 5582 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index 2b94eb6..f4e4b19 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -93,6 +93,12 @@ sub RainProcessing { my %funcHash = ( shuttersdevice => $shuttersDev, ); + + ::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj) + if($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none'); + + $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj + $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj(\%funcHash); ::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime , \&_RainUnprotected diff --git a/lib/FHEM/Automation/ShuttersControl/Shutters.pm b/lib/FHEM/Automation/ShuttersControl/Shutters.pm index a4f2420..6c9a0b2 100644 --- a/lib/FHEM/Automation/ShuttersControl/Shutters.pm +++ b/lib/FHEM/Automation/ShuttersControl/Shutters.pm @@ -57,22 +57,6 @@ use strict; use warnings; use utf8; -use GPUtils qw(GP_Import); - -## Import der FHEM Funktionen -BEGIN { - GP_Import( - qw( - defs - ReadingsVal - readingsSingleUpdate - gettimeofday - InternalTimer - CommandSet - Log3) - ); -} - sub new { my $class = shift; my $self = { @@ -114,15 +98,15 @@ sub setHardLockOut { && $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd ne 'none' ) { - CommandSet( undef, $self->{shuttersDev} . ' inhibit ' . $cmd ) + ::CommandSet( undef, $self->{shuttersDev} . ' inhibit ' . $cmd ) if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq 'inhibit' ); - CommandSet( undef, + ::CommandSet( undef, $self->{shuttersDev} . ' ' . ( $cmd eq 'on' ? 'blocked' : 'unblocked' ) ) if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq 'blocked' ); - CommandSet( undef, + ::CommandSet( undef, $self->{shuttersDev} . ' ' . ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) ) if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq @@ -223,6 +207,12 @@ sub setDriveCmd { . ' - antifreeze mode' ); } } + + ### Rainprotection unprotected Delay Routine + if ( $shutters->getRainUnprotectionDelayObj ne 'none' ) { + ::Remove::InternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj); + $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none'); + } my %h = ( shuttersDev => $self->{shuttersDev}, @@ -245,8 +235,8 @@ sub setDriveCmd { && $FHEM::Automation::ShuttersControl::ascDev->getSelfDefense eq 'on' ) { - InternalTimer( - gettimeofday() + + ::InternalTimer( + ::gettimeofday() + $FHEM::Automation::ShuttersControl::shutters ->getSelfDefenseAbsentDelay, \&FHEM::Automation::ShuttersControl::_SetCmdFn, \%h @@ -257,8 +247,8 @@ sub setDriveCmd { elsif ( $offSetStart > 0 && !$FHEM::Automation::ShuttersControl::shutters->getNoDelay ) { - InternalTimer( - gettimeofday() + int( + ::InternalTimer( + ::gettimeofday() + int( rand($offSet) + $FHEM::Automation::ShuttersControl::shutters ->getDelayStart @@ -354,14 +344,14 @@ sub setPosSetCmd { sub setLastDriveReading { my $self = shift; - my $shuttersDevHash = $defs{ $self->{shuttersDev} }; + my $shuttersDevHash = $::defs{ $self->{shuttersDev} }; my %h = ( devHash => $shuttersDevHash, lastDrive => $FHEM::Automation::ShuttersControl::shutters->getLastDrive, ); - InternalTimer( gettimeofday() + 0.1, + ::InternalTimer( ::gettimeofday() + 0.1, \&FHEM::Automation::ShuttersControl::_setShuttersLastDriveDelayed, \%h ); return; @@ -375,7 +365,7 @@ sub setLastPos { $self->{ $self->{shuttersDev} }{lastPos}{VAL} = $position if ( defined($position) ); - $self->{ $self->{shuttersDev} }{lastPos}{TIME} = int( gettimeofday() ) + $self->{ $self->{shuttersDev} }{lastPos}{TIME} = int( ::gettimeofday() ) if ( defined( $self->{ $self->{shuttersDev} }{lastPos} ) ); return; } @@ -386,11 +376,11 @@ sub setLastManPos { $self->{ $self->{shuttersDev} }{lastManPos}{VAL} = $position if ( defined($position) ); - $self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( gettimeofday() ) + $self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( ::gettimeofday() ) if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} ) && defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) ); $self->{ $self->{shuttersDev} }{lastManPos}{TIME} = - int( gettimeofday() ) - 86400 + int( ::gettimeofday() ) - 86400 if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} ) && !defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) ); return; @@ -472,6 +462,15 @@ sub setRainProtectionStatus { # Werte protected, unprotected return; } +sub setRainUnprotectionDelayObj { + my $self = shift; + my $value = shift; + + $self->{ $self->{shuttersDev} }->{RainProtection}->{UNPROTECTIONDELAYOBJVAL} = $value + if ( defined($value) ); + return; +} + sub setExternalTriggerStatus { my $self = shift; my $value = shift; @@ -666,7 +665,7 @@ sub getLastDrive { my $self = shift; $self->{ $self->{shuttersDev} }{lastDrive} = - ReadingsVal( $self->{shuttersDev}, 'ASC_ShuttersLastDrive', 'none' ) + ::ReadingsVal( $self->{shuttersDev}, 'ASC_ShuttersLastDrive', 'none' ) if ( !defined( $self->{ $self->{shuttersDev} }{lastDrive} ) ); return $self->{ $self->{shuttersDev} }{lastDrive}; @@ -756,6 +755,21 @@ sub getRainProtectionStatus { # Werte protected, unprotected ); } +sub getRainUnprotectionDelayObj { + my $self = shift; + + return ( + ( + defined( $self->{ $self->{shuttersDev} }->{RainProtection} ) + && defined( + $self->{ $self->{shuttersDev} }->{RainProtection}->{UNPROTECTIONDELAYOBJVAL} + ) + ) + ? $self->{ $self->{shuttersDev} }->{RainProtection}->{UNPROTECTIONDELAYOBJVAL} + : 'none' + ); +} + sub getSunsetUnixTime { my $self = shift; @@ -857,7 +871,7 @@ sub getRoommatesLastStatus { sub getOutTemp { my $self = shift; - return ReadingsVal( + return ::ReadingsVal( $FHEM::Automation::ShuttersControl::shutters->_getTempSensor, $FHEM::Automation::ShuttersControl::shutters->getTempSensorReading, -100 ); @@ -866,7 +880,7 @@ sub getOutTemp { sub getIdleDetection { my $self = shift; - return ReadingsVal( + return ::ReadingsVal( $self->{shuttersDev}, $FHEM::Automation::ShuttersControl::shutters->_getIdleDetectionReading, 'none' @@ -891,7 +905,7 @@ sub setShadingStatus { $self->{ $self->{shuttersDev} }{ShadingStatus}{VAL} = $value if ( defined($value) ); - $self->{ $self->{shuttersDev} }{ShadingStatus}{TIME} = int( gettimeofday() ) + $self->{ $self->{shuttersDev} }{ShadingStatus}{TIME} = int( ::gettimeofday() ) if ( defined( $self->{ $self->{shuttersDev} }{ShadingStatus} ) ); return; @@ -909,7 +923,7 @@ sub setShadingLastStatus { $self->{ $self->{shuttersDev} }{ShadingLastStatus}{VAL} = $value if ( defined($value) ); $self->{ $self->{shuttersDev} }{ShadingLastStatus}{TIME} = - int( gettimeofday() ) + int( ::gettimeofday() ) if ( defined( $self->{ $self->{shuttersDev} }{ShadingLastStatus} ) ); $self->{ $self->{shuttersDev} }{ShadingManualDriveStatus}{VAL} = 0 if ( $value eq 'out' ); -- 2.47.2 From 4d968405fd721cc2a90da6d20f1e38adc2bf0bc0 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 08:42:49 +0200 Subject: [PATCH 2/7] change remove InternalTimer Routine for Rain Unprotection --- controls_AutoShuttersControl.txt | 4 +-- .../ShuttersControl/Rainprotection.pm | 32 +++++++++++-------- .../Automation/ShuttersControl/Shutters.pm | 6 ---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 5824cda..f6380f2 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -2,7 +2,7 @@ UPD 2021-05-17_14:30:37 97974 FHEM/73_AutoShuttersControl.pm UPD 2021-05-17_14:34:49 74350 lib/FHEM/Automation/ShuttersControl.pm UPD 2020-06-22_09:41:40 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2020-07-26_17:36:29 2496 lib/FHEM/Automation/ShuttersControl/Roommate.pm -UPD 2021-05-18_08:26:00 32241 lib/FHEM/Automation/ShuttersControl/Shutters.pm +UPD 2021-05-18_08:41:07 31896 lib/FHEM/Automation/ShuttersControl/Shutters.pm UPD 2021-05-17_14:30:37 25329 lib/FHEM/Automation/ShuttersControl/Shading.pm UPD 2021-05-17_14:34:49 108472 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm UPD 2021-02-26_14:36:10 40628 lib/FHEM/Automation/ShuttersControl/Helper.pm @@ -13,4 +13,4 @@ UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr. UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-18_08:38:16 5582 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_08:42:09 5795 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index f4e4b19..b87f092 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -129,20 +129,26 @@ sub _RainUnprotected { $FHEM::Automation::ShuttersControl::shutters->setLastDrive( 'rain un-protected'); - $FHEM::Automation::ShuttersControl::shutters->setDriveCmd( - ( - $FHEM::Automation::ShuttersControl::shutters->getIsDay - ? $FHEM::Automation::ShuttersControl::shutters->getLastPos - : ( - $FHEM::Automation::ShuttersControl::shutters - ->getPrivacyDownStatus == 2 - ? $FHEM::Automation::ShuttersControl::shutters - ->getPrivacyDownPos - : $FHEM::Automation::ShuttersControl::shutters - ->getClosedPos - ) + + if ( $shutters->getRainUnprotectionDelayObj ne 'none' ) { + ::Remove::InternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj); + $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none'); + } + + $FHEM::Automation::ShuttersControl::shutters->setDriveCmd( + ( + $FHEM::Automation::ShuttersControl::shutters->getIsDay + ? $FHEM::Automation::ShuttersControl::shutters->getLastPos + : ( + $FHEM::Automation::ShuttersControl::shutters + ->getPrivacyDownStatus == 2 + ? $FHEM::Automation::ShuttersControl::shutters + ->getPrivacyDownPos + : $FHEM::Automation::ShuttersControl::shutters + ->getClosedPos ) - ); + ) + ); $FHEM::Automation::ShuttersControl::shutters ->setRainProtectionStatus('unprotected'); diff --git a/lib/FHEM/Automation/ShuttersControl/Shutters.pm b/lib/FHEM/Automation/ShuttersControl/Shutters.pm index 6c9a0b2..6d7ec48 100644 --- a/lib/FHEM/Automation/ShuttersControl/Shutters.pm +++ b/lib/FHEM/Automation/ShuttersControl/Shutters.pm @@ -207,12 +207,6 @@ sub setDriveCmd { . ' - antifreeze mode' ); } } - - ### Rainprotection unprotected Delay Routine - if ( $shutters->getRainUnprotectionDelayObj ne 'none' ) { - ::Remove::InternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj); - $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none'); - } my %h = ( shuttersDev => $self->{shuttersDev}, -- 2.47.2 From 7b988a395d4de6769769c9024e7b2ac761ff28a4 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 08:48:38 +0200 Subject: [PATCH 3/7] bugfix scalar --- controls_AutoShuttersControl.txt | 2 +- lib/FHEM/Automation/ShuttersControl/Rainprotection.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index f6380f2..b7be872 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -13,4 +13,4 @@ UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr. UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-18_08:42:09 5795 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_08:47:12 5796 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index b87f092..4c48600 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -97,7 +97,7 @@ sub RainProcessing { ::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj) if($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none'); - $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj + $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj; $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj(\%funcHash); ::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime -- 2.47.2 From 52fe367c814079e205ea336b31d912f60e517978 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 08:50:21 +0200 Subject: [PATCH 4/7] fix Global symbol "$shutters" requires explicit package name --- controls_AutoShuttersControl.txt | 2 +- lib/FHEM/Automation/ShuttersControl/Rainprotection.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index b7be872..2faf89c 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -13,4 +13,4 @@ UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr. UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-18_08:47:12 5796 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_08:49:58 5831 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index 4c48600..eff1a2f 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -130,7 +130,7 @@ sub _RainUnprotected { $FHEM::Automation::ShuttersControl::shutters->setLastDrive( 'rain un-protected'); - if ( $shutters->getRainUnprotectionDelayObj ne 'none' ) { + if ( $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none' ) { ::Remove::InternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj); $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none'); } -- 2.47.2 From 93420b80f1f67ed0b08ebb825facb6ddfbf60907 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 09:01:27 +0200 Subject: [PATCH 5/7] fix default value for rain waiting time --- controls_AutoShuttersControl.txt | 4 ++-- lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm | 2 +- lib/FHEM/Automation/ShuttersControl/Rainprotection.pm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 2faf89c..9a561a1 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -7,10 +7,10 @@ UPD 2021-05-17_14:30:37 25329 lib/FHEM/Automation/ShuttersControl/Shading.pm UPD 2021-05-17_14:34:49 108472 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm UPD 2021-02-26_14:36:10 40628 lib/FHEM/Automation/ShuttersControl/Helper.pm UPD 2020-06-22_09:41:40 2175 lib/FHEM/Automation/ShuttersControl/Window.pm -UPD 2021-04-27_07:52:31 11742 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm +UPD 2021-05-18_09:00:42 11741 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm UPD 2020-07-03_11:29:10 7251 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-18_08:49:58 5831 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_08:54:21 5829 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm b/lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm index 8aa1f0c..a195ea2 100644 --- a/lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm +++ b/lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm @@ -282,7 +282,7 @@ sub _getRainSensor { ? $pos : $FHEM::Automation::ShuttersControl::shutters->getClosedPos ); $self->{ASC_rainSensor}->{waitingTime} = - ( $pos ne 'none' ? $wait : 900 ); + ( $wait ne 'none' ? $wait : 0 ); return $self->{ASC_rainSensor}->{device}; } diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index eff1a2f..21f0747 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -131,7 +131,7 @@ sub _RainUnprotected { 'rain un-protected'); if ( $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none' ) { - ::Remove::InternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj); + ::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj); $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none'); } -- 2.47.2 From c1b71c12b428efcf65e4eba999a511ef1147e991 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 09:32:07 +0200 Subject: [PATCH 6/7] change unprotection Code --- controls_AutoShuttersControl.txt | 2 +- lib/FHEM/Automation/ShuttersControl/Rainprotection.pm | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index 9a561a1..c8af8be 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -13,4 +13,4 @@ UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr. UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-18_08:54:21 5829 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_09:31:52 5957 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index 21f0747..a90ef44 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -103,6 +103,9 @@ sub RainProcessing { ::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime , \&_RainUnprotected , \%funcHash ); + + $FHEM::Automation::ShuttersControl::shutters + ->setRainProtectionStatus('unprotected'); } } -- 2.47.2 From f5004dbc9344de133df5f0332c2a8dcbe5b0703a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 May 2021 09:58:00 +0200 Subject: [PATCH 7/7] change Code for rain protection --- controls_AutoShuttersControl.txt | 2 +- .../ShuttersControl/Rainprotection.pm | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/controls_AutoShuttersControl.txt b/controls_AutoShuttersControl.txt index c8af8be..7472a3e 100644 --- a/controls_AutoShuttersControl.txt +++ b/controls_AutoShuttersControl.txt @@ -13,4 +13,4 @@ UPD 2021-01-29_10:06:33 52525 lib/FHEM/Automation/ShuttersControl/Shutters/Attr. UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-01-29_10:06:33 3980 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm -UPD 2021-05-18_09:31:52 5957 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +UPD 2021-05-18_09:57:48 6195 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm diff --git a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm index a90ef44..235554d 100644 --- a/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm +++ b/lib/FHEM/Automation/ShuttersControl/Rainprotection.pm @@ -79,27 +79,27 @@ sub RainProcessing { && $FHEM::Automation::ShuttersControl::shutters->getStatus != $rainClosedPos && $FHEM::Automation::ShuttersControl::shutters - ->getRainProtectionStatus eq 'unprotected' ) + ->getRainProtectionStatus eq 'unprotected' + || ( $FHEM::Automation::ShuttersControl::shutters + ->getRainProtectionStatus eq 'unprotected' + && $FHEM::Automation::ShuttersControl::shutters + ->getRainUnprotectionDelayObj ne 'none') + ) { _RainProtected(); } elsif ( ( $val == 0 || $val < $triggerMin ) && $FHEM::Automation::ShuttersControl::shutters->getStatus == - $rainClosedPos + $rainClosedPos && IsAfterShuttersManualBlocking($shuttersDev) && $FHEM::Automation::ShuttersControl::shutters - ->getRainProtectionStatus eq 'protected' ) + ->getRainProtectionStatus eq 'protected' ) { my %funcHash = ( shuttersdevice => $shuttersDev, ); - - ::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj) - if($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none'); - - $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj; - $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj(\%funcHash); + $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj(\%funcHash); ::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime , \&_RainUnprotected , \%funcHash ); @@ -114,6 +114,11 @@ sub RainProcessing { ### es muss noch beobachtet werden ob die Auswahl des Rollos welches bearbeitet werden soll bestehen bleibt oder mit in die neuen Funktionen übergeben werden muss sub _RainProtected { + ::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj) + if($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none'); + + $FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none'); + $FHEM::Automation::ShuttersControl::shutters->setLastDrive( 'rain protected'); $FHEM::Automation::ShuttersControl::shutters->setDriveCmd( -- 2.47.2