fix IsDay for brightness, fix EventProcessingBrightness Weekend Time

This commit is contained in:
Marko Oldenburg 2019-05-07 05:58:59 +02:00
parent da6fd56674
commit 9a09d86214

View File

@ -44,7 +44,7 @@ use strict;
use warnings; use warnings;
use FHEM::Meta; use FHEM::Meta;
my $version = '0.6.7'; my $version = '0.6.7.1-patchBrightness';
sub AutoShuttersControl_Initialize($) { sub AutoShuttersControl_Initialize($) {
my ($hash) = @_; my ($hash) = @_;
@ -1424,14 +1424,38 @@ sub EventProcessingBrightness($@) {
. $brightnessMaxVal . $brightnessMaxVal
. ' oder kleiner dem eingestellten Sunset-Wert: ' . ' oder kleiner dem eingestellten Sunset-Wert: '
. $brightnessMinVal . $brightnessMinVal
. ' ist' ); . ' ist. Werte für weitere Parameter - getUp ist: '
. $shutters->getUp
. ' getDown ist: '
. $shutters->getDown
. ' getSunrise ist: '
. $shutters->getSunrise
. ' getSunset ist: '
. $shutters->getSunset);
if ( if (
(
(
(
int( gettimeofday() / 86400 ) != int( int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00', $shutters->getTimeUpEarly ) / 86400 computeAlignTime( '24:00',
$shutters->getTimeUpEarly ) / 86400
)
and not IsWe()
)
or (
int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00',
$shutters->getTimeUpWeHoliday ) / 86400
)
and IsWe()
and $ascDev->getSunriseTimeWeHoliday eq 'on'
)
) )
and int( gettimeofday() / 86400 ) == int( and int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00', $shutters->getTimeUpLate ) / 86400 computeAlignTime( '24:00', $shutters->getTimeUpLate ) /
86400
)
) )
and $1 > $brightnessMaxVal and $1 > $brightnessMaxVal
and $shutters->getUp eq 'brightness' and $shutters->getUp eq 'brightness'
@ -2628,14 +2652,27 @@ sub IsDay($) {
if ( if (
( (
$shutters->getDown eq 'brightness' $shutters->getModeDown eq 'brightness'
or $shutters->getUp eq 'brightness' or $shutters->getModeUp eq 'brightness'
) )
and ( or (
(
(
( (
int( gettimeofday() / 86400 ) != int( int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00', $shutters->getTimeUpEarly ) / computeAlignTime( '24:00',
86400 $shutters->getTimeUpEarly ) / 86400
)
and not IsWe()
)
or (
int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00',
$shutters->getTimeUpWeHoliday ) / 86400
)
and IsWe()
and $ascDev->getSunriseTimeWeHoliday eq 'on'
)
) )
and int( gettimeofday() / 86400 ) == int( and int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00', $shutters->getTimeUpLate ) / computeAlignTime( '24:00', $shutters->getTimeUpLate ) /
@ -2671,10 +2708,13 @@ sub IsDay($) {
$brightnessMaxVal = $ascDev->getBrightnessMaxVal; $brightnessMaxVal = $ascDev->getBrightnessMaxVal;
} }
##### Nach Sonnenuntergang / Abends
$respIsDay = ( $respIsDay = (
( (
( $shutters->getBrightness > $brightnessMinVal and $isday ) ( $shutters->getBrightness > $brightnessMinVal
or $shutters->getSunset and $isday
and not $shutters->getSunset )
or not $shutters->getSunset
) ? 1 : 0 ) ? 1 : 0
) if ( $shutters->getDown eq 'brightness' ); ) if ( $shutters->getDown eq 'brightness' );
@ -2689,9 +2729,12 @@ sub IsDay($) {
. ' Sunset: ' . ' Sunset: '
. $shutters->getSunset ); . $shutters->getSunset );
##### Nach Sonnenauf / Morgens
$respIsDay = ( $respIsDay = (
( (
( $shutters->getBrightness > $brightnessMaxVal and not $isday ) ( $shutters->getBrightness > $brightnessMaxVal
and not $isday
and not $shutters->getSunrise )
or $respIsDay or $respIsDay
or $shutters->getSunrise or $shutters->getSunrise
) ? 1 : 0 ) ? 1 : 0
@ -2705,7 +2748,7 @@ sub IsDay($) {
. $shutters->getBrightness . $shutters->getBrightness
. ' BrightnessMax: ' . ' BrightnessMax: '
. $brightnessMaxVal . $brightnessMaxVal
. ' Sunset: ' . ' Sunrise: '
. $shutters->getSunrise ); . $shutters->getSunrise );
} }