From 6efe34d9e9f6f48ac2f747df639271d2c9144560 Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Mon, 23 Mar 2020 11:05:03 +0000 Subject: [PATCH] 73_AutoShuttersControl: add holidayWeekend support for brightness git-svn-id: https://svn.fhem.de/fhem/trunk@21491 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/73_AutoShuttersControl.pm | 93 ++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 2 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 1543921da..5c13106ea 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - feature: 73_AutoShuttersControl: add holidayWeekend support for brightness - bugfix: 73_AutoShuttersControl: fix PrivacyDownStatus in Brightness, add set brightness average max objects in array attribut - change: 93_DbLog: logfile entry if DBI module not installed, Forum: #109382 diff --git a/fhem/FHEM/73_AutoShuttersControl.pm b/fhem/FHEM/73_AutoShuttersControl.pm index 8c1b0b77e..cc41471b3 100644 --- a/fhem/FHEM/73_AutoShuttersControl.pm +++ b/fhem/FHEM/73_AutoShuttersControl.pm @@ -3900,9 +3900,98 @@ sub ShuttersSunrise($$) { } } elsif ( $shutters->getUp eq 'brightness' ) { - $shuttersSunriseUnixtime = - computeAlignTime( '24:00', $shutters->getTimeUpLate ); + if ( ( IsWe() or IsWeTomorrow() ) + and $ascDev->getSunriseTimeWeHoliday eq 'on' + and $shutters->getTimeUpWeHoliday ne '01:25' ) + { + if ( not IsWeTomorrow() ) { + if ( + IsWe() + and int( gettimeofday() / 86400 ) == int( + ( + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ) + ) / 86400 + ) + ) + { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ); + } + elsif ( + int( gettimeofday() / 86400 ) == int( + ( + computeAlignTime( '24:00', $shutters->getTimeUpLate ) + ) / 86400 + ) + ) + { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ); + } + else { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpLate ); + } + } + else { + if ( + IsWe() + and ( + int( gettimeofday() / 86400 ) == int( + ( + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ) + ) / 86400 + ) + or int( gettimeofday() / 86400 ) != int( + ( + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ) + ) / 86400 + ) + ) + ) + { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ); + } + elsif ( + int( gettimeofday() / 86400 ) == int( + ( + computeAlignTime( '24:00', $shutters->getTimeUpLate ) + ) / 86400 + ) + ) + { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpLate ); + } + else { + if ( + int( gettimeofday() / 86400 ) == int( + ( + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ) + ) / 86400 + ) + ) + { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ); + } + else { + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpWeHoliday ); + } + } + } + } + else { + + + + $shuttersSunriseUnixtime = + computeAlignTime( '24:00', $shutters->getTimeUpLate ); + } } + return $shuttersSunriseUnixtime; } elsif ( $tm eq 'real' ) {