From 1ebe1d2f735e8cb3bd29ed5ada35c040df411861 Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Tue, 26 Feb 2019 10:31:26 +0000 Subject: [PATCH] 73_AutoShuttersControl: fix Bug open Window befor IsDay and closed git-svn-id: https://svn.fhem.de/fhem/trunk@18742 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/73_AutoShuttersControl.pm | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 324acdda0..02c297a4a 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 73_AutoShuttersControl: fix Bug open Window befor IsDay and closed + IsDay - changed: 74_Unifi: removed deprecated UnifiSwitch-functions! - bugfix: 74_UnififSwitch: fixed poe restart - feature: 57_Calendar.pm: new features and attributes diff --git a/fhem/FHEM/73_AutoShuttersControl.pm b/fhem/FHEM/73_AutoShuttersControl.pm index bb2afe109..1dee9e238 100644 --- a/fhem/FHEM/73_AutoShuttersControl.pm +++ b/fhem/FHEM/73_AutoShuttersControl.pm @@ -41,7 +41,7 @@ package main; use strict; use warnings; -my $version = '0.4.0.6'; +my $version = '0.4.0.7'; sub AutoShuttersControl_Initialize($) { my ($hash) = @_; @@ -81,10 +81,10 @@ sub AutoShuttersControl_Initialize($) { $hash->{NotifyOrderPrefix} = '51-'; # Order Nummer für NotifyFn ## Ist nur damit sich bei einem reload auch die Versionsnummer erneuert. - foreach my $d ( sort keys %{ $modules{AutoShuttersControl}{defptr} } ) { - my $hash = $modules{AutoShuttersControl}{defptr}{$d}; - $hash->{VERSION} = $version; - } +# foreach my $d ( sort keys %{ $modules{AutoShuttersControl}{defptr} } ) { +# my $hash = $modules{AutoShuttersControl}{defptr}{$d}; +# $hash->{VERSION} = $version; +# } } ## unserer packagename @@ -2053,9 +2053,20 @@ sub ExtractNotifyDevFromEvent($$$) { ## Ist Tag oder Nacht für den entsprechende Rolladen sub IsDay($$) { my ( $hash, $shuttersDev ) = @_; + $shutters->setShuttersDev($shuttersDev); + my $name = $hash->{NAME}; - return ( ShuttersSunrise( $hash, $shuttersDev, 'unix' ) > + my $isday = ( ShuttersSunrise( $hash, $shuttersDev, 'unix' ) > ShuttersSunset( $hash, $shuttersDev, 'unix' ) ? 1 : 0 ); + my $respIsDay = $isday; + + $respIsDay = ( ($shutters->getBrightness > $shutters->getBrightnessMinVal and $isday) ? 1 : 0 ) + if ( $shutters->getDown eq 'brightness' ); + + $respIsDay = ( (($shutters->getBrightness > $shutters->getBrightnessMaxVal and not $isday) or $respIsDay) ? 1 : 0 ) + if ( $shutters->getUp eq 'brightness' ); + + return $respIsDay; } sub ShuttersSunrise($$$) { @@ -2710,8 +2721,7 @@ sub getFreezeStatus { if ( $shutters->getAntiFreeze eq 'soft' ) { return 1; } - elsif ($shutters->getAntiFreeze eq $daytime - or $shutters->getAntiFreeze eq $daytime ) + elsif ($shutters->getAntiFreeze eq $daytime ) { return 2; }