add new modul file for EventProcessing functions

This commit is contained in:
Marko Oldenburg 2020-07-09 08:21:44 +02:00
parent f74ec772b9
commit 770be1d91e
5 changed files with 3111 additions and 2157 deletions

View File

@ -1,9 +1,9 @@
UPD 2020-07-08_22:02:31 97041 FHEM/73_AutoShuttersControl.pm
UPD 2020-07-08_22:06:53 143748 lib/FHEM/Automation/ShuttersControl.pm
UPD 2020-07-09_08:21:08 74284 lib/FHEM/Automation/ShuttersControl.pm
UPD 2020-06-22_09:41:40 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm
UPD 2020-07-07_14:49:19 2496 lib/FHEM/Automation/ShuttersControl/Roommate.pm
UPD 2020-07-08_22:06:53 30760 lib/FHEM/Automation/ShuttersControl/Shutters.pm
UPD 2020-07-09_07:37:23 21703 lib/FHEM/Automation/ShuttersControl/Shading.pm
UPD 2020-07-09_08:19:25 23216 lib/FHEM/Automation/ShuttersControl/Shading.pm
UPD 2020-06-22_09:41:40 2175 lib/FHEM/Automation/ShuttersControl/Window.pm
UPD 2020-07-08_22:06:53 11569 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
UPD 2020-07-03_11:29:10 7251 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -108,27 +108,40 @@ sub PositionValueWindowRec {
my $posValue = shift;
if ( CheckIfShuttersWindowRecOpen($shuttersDev) == 1
&& $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen eq 'on' )
&& $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen eq
'on' )
{
$posValue = $FHEM::Automation::ShuttersControl::shutters->getVentilatePos;
$posValue =
$FHEM::Automation::ShuttersControl::shutters->getVentilatePos;
}
elsif ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2
&& $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq 'threestate'
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlComfort eq 'on' )
&& $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq
'threestate'
&& $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlComfort eq 'on' )
{
$posValue = $FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos;
$posValue =
$FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos;
}
elsif (
CheckIfShuttersWindowRecOpen($shuttersDev) == 2
&& ( $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq 'threestate'
|| $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq 'twostate' )
&& $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen eq 'on'
&& ( $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq
'threestate'
|| $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq
'twostate' )
&& $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen eq
'on'
)
{
$posValue = $FHEM::Automation::ShuttersControl::shutters->getVentilatePos;
$posValue =
$FHEM::Automation::ShuttersControl::shutters->getVentilatePos;
}
if ( $FHEM::Automation::ShuttersControl::shutters->getQueryShuttersPos($posValue) ) {
if (
$FHEM::Automation::ShuttersControl::shutters->getQueryShuttersPos(
$posValue)
)
{
$posValue = $FHEM::Automation::ShuttersControl::shutters->getStatus;
}
@ -190,12 +203,16 @@ sub CheckIfShuttersWindowRecOpen {
{
return 2;
}
elsif ($FHEM::Automation::ShuttersControl::shutters->getWinStatus =~ m{tilt}xms
&& $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq 'threestate' ) # CK: covers: tilt|tilted
elsif (
$FHEM::Automation::ShuttersControl::shutters->getWinStatus =~ m{tilt}xms
&& $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq
'threestate' ) # CK: covers: tilt|tilted
{
return 1;
}
elsif ( $FHEM::Automation::ShuttersControl::shutters->getWinStatus =~ m{[Cc]lose|true}xms ) {
elsif ( $FHEM::Automation::ShuttersControl::shutters->getWinStatus =~
m{[Cc]lose|true}xms )
{
return 0;
} # CK: covers: close|closed
}
@ -252,42 +269,56 @@ sub _IsDay {
ShuttersSunset( $shuttersDev, 'unix' ) ? 1 : 0 );
my $respIsDay = $isday;
FHEM::Automation::ShuttersControl::ASC_Debug( 'FnIsDay: ' . $shuttersDev . ' Allgemein: ' . $respIsDay );
FHEM::Automation::ShuttersControl::ASC_Debug(
'FnIsDay: ' . $shuttersDev . ' Allgemein: ' . $respIsDay );
if (
(
(
(
int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly ) /
86400
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly ) / 86400
)
&& !IsWe()
)
|| (
int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ) /
86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
) / 86400
)
&& IsWe()
&& $FHEM::Automation::ShuttersControl::ascDev->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ne '01:25'
&& $FHEM::Automation::ShuttersControl::ascDev
->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday ne '01:25'
)
)
&& int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpLate ) /
86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
) / 86400
)
)
|| (
int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeDownEarly ) /
86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeDownEarly
) / 86400
)
&& int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeDownLate ) /
86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeDownLate
) / 86400
)
)
)
@ -296,13 +327,17 @@ sub _IsDay {
$respIsDay = (
(
(
$FHEM::Automation::ShuttersControl::shutters->getBrightness > $brightnessMinVal
$FHEM::Automation::ShuttersControl::shutters
->getBrightness > $brightnessMinVal
&& $isday
&& !$FHEM::Automation::ShuttersControl::shutters->getSunset
&& !$FHEM::Automation::ShuttersControl::shutters
->getSunset
)
|| !$FHEM::Automation::ShuttersControl::shutters->getSunset
) ? 1 : 0
) if ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'brightness' );
)
if ( $FHEM::Automation::ShuttersControl::shutters->getDown eq
'brightness' );
FHEM::Automation::ShuttersControl::ASC_Debug( 'FnIsDay: '
. $shuttersDev
@ -319,14 +354,18 @@ sub _IsDay {
$respIsDay = (
(
(
$FHEM::Automation::ShuttersControl::shutters->getBrightness > $brightnessMaxVal
$FHEM::Automation::ShuttersControl::shutters
->getBrightness > $brightnessMaxVal
&& !$isday
&& $FHEM::Automation::ShuttersControl::shutters->getSunrise
&& $FHEM::Automation::ShuttersControl::shutters
->getSunrise
)
|| $respIsDay
|| $FHEM::Automation::ShuttersControl::shutters->getSunrise
) ? 1 : 0
) if ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'brightness' );
)
if ( $FHEM::Automation::ShuttersControl::shutters->getUp eq
'brightness' );
FHEM::Automation::ShuttersControl::ASC_Debug( 'FnIsDay: '
. $shuttersDev
@ -350,27 +389,38 @@ sub ShuttersSunrise {
my $autoAstroMode;
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
if ( $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeMorning ne 'none' ) {
$autoAstroMode = $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeMorning;
if ( $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeMorning
ne 'none' )
{
$autoAstroMode =
$autoAstroMode . '=' . $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeMorningHorizon
$FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeMorning;
$autoAstroMode =
$autoAstroMode . '='
. $FHEM::Automation::ShuttersControl::shutters
->getAutoAstroModeMorningHorizon
if ( $autoAstroMode eq 'HORIZON' );
}
else {
$autoAstroMode = $FHEM::Automation::ShuttersControl::ascDev->getAutoAstroModeMorning;
$autoAstroMode =
$autoAstroMode . '=' . $FHEM::Automation::ShuttersControl::ascDev->getAutoAstroModeMorningHorizon
$FHEM::Automation::ShuttersControl::ascDev->getAutoAstroModeMorning;
$autoAstroMode =
$autoAstroMode . '='
. $FHEM::Automation::ShuttersControl::ascDev
->getAutoAstroModeMorningHorizon
if ( $autoAstroMode eq 'HORIZON' );
}
my $oldFuncHash = $FHEM::Automation::ShuttersControl::shutters->getInTimerFuncHash;
my $oldFuncHash =
$FHEM::Automation::ShuttersControl::shutters->getInTimerFuncHash;
my $shuttersSunriseUnixtime =
computeAlignTime( '24:00', sunrise( 'REAL', 0, '4:30', '8:30' ) );
if ( $tm eq 'unix' ) {
if ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'astro' ) {
if ( ( IsWe() || IsWe('tomorrow') )
&& $FHEM::Automation::ShuttersControl::ascDev->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ne '01:25' )
&& $FHEM::Automation::ShuttersControl::ascDev
->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday ne '01:25' )
{
if ( !IsWe('tomorrow') ) {
if (
@ -380,8 +430,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
) / 86400
@ -392,8 +444,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
);
@ -406,8 +460,10 @@ sub ShuttersSunrise {
sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) + 1
) / 86400
@ -418,8 +474,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
);
@ -431,8 +489,10 @@ sub ShuttersSunrise {
sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) + 1
);
@ -447,8 +507,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
) / 86400
@ -458,8 +520,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
) / 86400
@ -471,8 +535,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
);
@ -485,8 +551,10 @@ sub ShuttersSunrise {
sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) + 1
) / 86400
@ -499,8 +567,10 @@ sub ShuttersSunrise {
sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) + 1
);
@ -512,8 +582,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
) / 86400
@ -524,8 +596,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 86401
);
@ -535,8 +609,10 @@ sub ShuttersSunrise {
computeAlignTime(
'24:00',
sunrise_abs(
$autoAstroMode, 0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) + 1
);
@ -551,8 +627,10 @@ sub ShuttersSunrise {
sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) + 1
);
@ -560,8 +638,10 @@ sub ShuttersSunrise {
if ( defined($oldFuncHash)
&& ref($oldFuncHash) eq 'HASH'
&& ( IsWe() || IsWe('tomorrow') )
&& $FHEM::Automation::ShuttersControl::ascDev->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ne '01:25' )
&& $FHEM::Automation::ShuttersControl::ascDev
->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday ne '01:25' )
{
if ( !IsWe('tomorrow') ) {
if (
@ -572,8 +652,10 @@ sub ShuttersSunrise {
sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) + 1
) / 86400
@ -595,92 +677,116 @@ sub ShuttersSunrise {
&& $oldFuncHash->{sunrisetime} < gettimeofday() );
}
}
elsif ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'time' ) {
elsif ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'time' )
{
if ( ( IsWe() || IsWe('tomorrow') )
&& $FHEM::Automation::ShuttersControl::ascDev->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ne '01:25' )
&& $FHEM::Automation::ShuttersControl::ascDev
->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday ne '01:25' )
{
if ( !IsWe('tomorrow') ) {
if (
int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ) / 86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday );
}
elsif (
int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly ) / 86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly
) / 86400
)
&& $FHEM::Automation::ShuttersControl::shutters->getSunrise
&& $FHEM::Automation::ShuttersControl::shutters
->getSunrise
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly )
+ 86400;
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly ) + 86400;
}
else {
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly );
}
}
else {
if (
IsWe()
&& int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ) / 86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday );
}
elsif (
int( gettimeofday() / 86400 ) == int(
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly ) / 86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly );
}
elsif (
int( gettimeofday() / 86400 ) != int(
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ) / 86400
computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday );
}
else {
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ) + 86400;
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday ) + 86400;
}
}
}
else {
$shuttersSunriseUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpEarly );
}
}
elsif ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'brightness' ) {
elsif ( $FHEM::Automation::ShuttersControl::shutters->getUp eq
'brightness' )
{
if ( ( IsWe() || IsWe('tomorrow') )
&& $FHEM::Automation::ShuttersControl::ascDev->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday ne '01:25' )
&& $FHEM::Automation::ShuttersControl::ascDev
->getSunriseTimeWeHoliday eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday ne '01:25' )
{
if ( !IsWe('tomorrow') ) {
if (
@ -688,33 +794,38 @@ sub ShuttersSunrise {
&& int( gettimeofday() / 86400 ) == int(
(
computeAlignTime(
'24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday );
}
elsif (
int( gettimeofday() / 86400 ) == int(
(
computeAlignTime(
'24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday );
}
else {
$shuttersSunriseUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpLate );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate );
}
}
else {
@ -724,74 +835,93 @@ sub ShuttersSunrise {
int( gettimeofday() / 86400 ) == int(
(
computeAlignTime(
'24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) / 86400
)
|| int( gettimeofday() / 86400 ) != int(
(
computeAlignTime(
'24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) / 86400
)
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday );
}
elsif (
int( gettimeofday() / 86400 ) == int(
(
computeAlignTime(
'24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate
)
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpLate );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpLate );
}
else {
if (
int( gettimeofday() / 86400 ) == int(
(
computeAlignTime(
'24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
)
) / 86400
)
)
{
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
);
}
else {
$shuttersSunriseUnixtime =
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpWeHoliday );
$shuttersSunriseUnixtime = computeAlignTime(
'24:00',
$FHEM::Automation::ShuttersControl::shutters
->getTimeUpWeHoliday
);
}
}
}
}
else {
$shuttersSunriseUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeUpLate );
$shuttersSunriseUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
);
}
}
return $shuttersSunriseUnixtime;
}
elsif ( $tm eq 'real' ) {
return sunrise_abs( $autoAstroMode, 0, $FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate )
return sunrise_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeUpLate
)
if ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'astro' );
return $FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly if ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'time' );
return $FHEM::Automation::ShuttersControl::shutters->getTimeUpEarly
if ( $FHEM::Automation::ShuttersControl::shutters->getUp eq 'time' );
}
return;
@ -804,32 +934,44 @@ sub ShuttersSunset {
my $autoAstroMode;
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
if ( $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeEvening ne 'none' ) {
$autoAstroMode = $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeEvening;
if ( $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeEvening
ne 'none' )
{
$autoAstroMode =
$autoAstroMode . '=' . $FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeEveningHorizon
$FHEM::Automation::ShuttersControl::shutters->getAutoAstroModeEvening;
$autoAstroMode =
$autoAstroMode . '='
. $FHEM::Automation::ShuttersControl::shutters
->getAutoAstroModeEveningHorizon
if ( $autoAstroMode eq 'HORIZON' );
}
else {
$autoAstroMode = $FHEM::Automation::ShuttersControl::ascDev->getAutoAstroModeEvening;
$autoAstroMode =
$autoAstroMode . '=' . $FHEM::Automation::ShuttersControl::ascDev->getAutoAstroModeEveningHorizon
$FHEM::Automation::ShuttersControl::ascDev->getAutoAstroModeEvening;
$autoAstroMode =
$autoAstroMode . '='
. $FHEM::Automation::ShuttersControl::ascDev
->getAutoAstroModeEveningHorizon
if ( $autoAstroMode eq 'HORIZON' );
}
my $oldFuncHash = $FHEM::Automation::ShuttersControl::shutters->getInTimerFuncHash;
my $oldFuncHash =
$FHEM::Automation::ShuttersControl::shutters->getInTimerFuncHash;
my $shuttersSunsetUnixtime =
computeAlignTime( '24:00', sunset( 'REAL', 0, '15:30', '21:30' ) );
if ( $tm eq 'unix' ) {
if ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'astro' ) {
if ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'astro' )
{
$shuttersSunsetUnixtime = (
computeAlignTime(
'24:00',
sunset_abs(
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeDownEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeDownLate
$FHEM::Automation::ShuttersControl::shutters
->getTimeDownEarly,
$FHEM::Automation::ShuttersControl::shutters
->getTimeDownLate
)
) + 1
);
@ -840,24 +982,34 @@ sub ShuttersSunset {
&& $oldFuncHash->{sunsettime} < gettimeofday() );
}
}
elsif ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'time' ) {
$shuttersSunsetUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeDownEarly );
elsif (
$FHEM::Automation::ShuttersControl::shutters->getDown eq 'time' )
{
$shuttersSunsetUnixtime = computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeDownEarly
);
}
elsif ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'brightness' ) {
elsif ( $FHEM::Automation::ShuttersControl::shutters->getDown eq
'brightness' )
{
$shuttersSunsetUnixtime =
computeAlignTime( '24:00', $FHEM::Automation::ShuttersControl::shutters->getTimeDownLate );
computeAlignTime( '24:00',
$FHEM::Automation::ShuttersControl::shutters->getTimeDownLate );
}
return $shuttersSunsetUnixtime;
}
elsif ( $tm eq 'real' ) {
return sunset_abs(
$autoAstroMode, 0,
$autoAstroMode,
0,
$FHEM::Automation::ShuttersControl::shutters->getTimeDownEarly,
$FHEM::Automation::ShuttersControl::shutters->getTimeDownLate
) if ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'astro' );
)
if (
$FHEM::Automation::ShuttersControl::shutters->getDown eq 'astro' );
return $FHEM::Automation::ShuttersControl::shutters->getTimeDownEarly
if ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'time' );
if (
$FHEM::Automation::ShuttersControl::shutters->getDown eq 'time' );
}
return;
@ -869,16 +1021,31 @@ sub IsAfterShuttersTimeBlocking {
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
if (
( int( gettimeofday() ) - $FHEM::Automation::ShuttersControl::shutters->getLastManPosTimestamp ) <
(
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters->getLastManPosTimestamp
) <
$FHEM::Automation::ShuttersControl::shutters->getBlockingTimeAfterManual
|| ( !$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& defined( $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime )
&& $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime - ( int( gettimeofday() ) ) <
$FHEM::Automation::ShuttersControl::shutters->getBlockingTimeBeforDayOpen )
|| ( $FHEM::Automation::ShuttersControl::shutters->getIsDay
&& defined( $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime )
&& $FHEM::Automation::ShuttersControl::shutters->getSunsetUnixTime - ( int( gettimeofday() ) ) <
$FHEM::Automation::ShuttersControl::shutters->getBlockingTimeBeforNightClose )
|| (
!$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& defined(
$FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime
)
&& $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime
- ( int( gettimeofday() ) ) <
$FHEM::Automation::ShuttersControl::shutters
->getBlockingTimeBeforDayOpen
)
|| (
$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& defined(
$FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime
)
&& $FHEM::Automation::ShuttersControl::shutters->getSunsetUnixTime
- ( int( gettimeofday() ) ) <
$FHEM::Automation::ShuttersControl::shutters
->getBlockingTimeBeforNightClose
)
)
{
return 0;
@ -891,20 +1058,34 @@ sub IsAfterShuttersManualBlocking {
my $shuttersDev = shift;
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
if ( $FHEM::Automation::ShuttersControl::ascDev->getBlockAscDrivesAfterManual
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getOpenPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getClosedPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getWindPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getShadingPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getVentilatePos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getAntiFreezePos
&& $FHEM::Automation::ShuttersControl::shutters->getLastDrive eq 'manual' )
if (
$FHEM::Automation::ShuttersControl::ascDev->getBlockAscDrivesAfterManual
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getOpenPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getClosedPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getWindPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getShadingPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getVentilatePos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getAntiFreezePos
&& $FHEM::Automation::ShuttersControl::shutters->getLastDrive eq
'manual' )
{
return 0;
}
elsif ( ( int( gettimeofday() ) - $FHEM::Automation::ShuttersControl::shutters->getLastManPosTimestamp ) <
$FHEM::Automation::ShuttersControl::shutters->getBlockingTimeAfterManual )
elsif (
(
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters->getLastManPosTimestamp
) <
$FHEM::Automation::ShuttersControl::shutters->getBlockingTimeAfterManual
)
{
return 0;
}
@ -975,7 +1156,4 @@ sub IsAdv {
return $adv;
}
1;

View File

@ -89,7 +89,8 @@ sub CheckASC_ConditionsForShadingFn {
' no valid data from the ASC temperature sensor, is ASC_tempSensor attribut set?'
if ( $FHEM::Automation::ShuttersControl::ascDev->getOutTemp == -100 );
$error .= ' no twilight device found'
if ( $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice eq 'none' );
if ( $FHEM::Automation::ShuttersControl::ascDev->_getTwilightDevice eq
'none' );
my $count = 1;
for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
@ -121,7 +122,8 @@ sub _CheckShuttersConditionsForShadingFn {
$infoMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlShading eq 'on'
&& $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters->getOutTemp == -100
? ' shading active, global temp sensor is set, but shutters temperature sensor is not set'
: ''
@ -129,15 +131,18 @@ sub _CheckShuttersConditionsForShadingFn {
$warnMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlShading eq 'on'
&& $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading eq 'on'
? ' global shading active but ASC_Shading_Mode attribut is not set or off'
: ''
);
$errorMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlShading ne 'on'
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlShading ne 'off'
&& $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading ne 'on'
&& $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading ne 'off'
? ' ASC_Shading_Mode attribut is set but global shading has errors, look at ASC device '
. '<a href="'
. '/fhem?detail='
@ -150,7 +155,8 @@ sub _CheckShuttersConditionsForShadingFn {
$errorMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getBrightness == -1
&& $FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
&& $FHEM::Automation::ShuttersControl::shutters->getShadingMode ne
'off'
? ' no brightness sensor found, please set ASC_BrightnessSensor attribut'
: ''
);
@ -185,7 +191,8 @@ sub ShadingProcessing {
my $name = $hash->{NAME};
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
my $brightness = $FHEM::Automation::ShuttersControl::shutters->getBrightnessAverage;
my $brightness =
$FHEM::Automation::ShuttersControl::shutters->getBrightnessAverage;
FHEM::Automation::ShuttersControl::ASC_Debug(
'ShadingProcessing: '
@ -203,13 +210,25 @@ sub ShadingProcessing {
. ', Azimut Endschattung: '
. $azimuthRight
. ', Ist es nach der Zeitblockadezeit: '
. ( FHEM::Automation::ShuttersControl::IsAfterShuttersTimeBlocking($shuttersDev) ? 'JA' : 'NEIN' )
. (
FHEM::Automation::ShuttersControl::IsAfterShuttersTimeBlocking(
$shuttersDev) ? 'JA' : 'NEIN'
)
. ', Das Rollo ist in der Beschattung und wurde manuell gefahren: '
. ( $FHEM::Automation::ShuttersControl::shutters->getShadingManualDriveStatus ? 'JA' : 'NEIN' )
. (
$FHEM::Automation::ShuttersControl::shutters
->getShadingManualDriveStatus ? 'JA' : 'NEIN'
)
. ', Ist es nach der Hälfte der Beschattungswartezeit: '
. (
( int( gettimeofday() ) - $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp ) <
( $FHEM::Automation::ShuttersControl::shutters->getShadingWaitingPeriod / 2 ) ? 'NEIN' : 'JA'
(
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp
) < (
$FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod / 2
) ? 'NEIN' : 'JA'
)
);
@ -226,22 +245,31 @@ sub ShadingProcessing {
. $outTemp );
return
if ( $azimuth == -1
if (
$azimuth == -1
|| $elevation == -1
|| $brightness == -1
|| $outTemp == -100
|| ( int( gettimeofday() ) - $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp ) <
( $FHEM::Automation::ShuttersControl::shutters->getShadingWaitingPeriod / 2 )
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off' );
|| (
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ) < (
$FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod / 2
)
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
);
Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
. $shuttersDev
. " Nach dem return" );
my $getShadingPos = $FHEM::Automation::ShuttersControl::shutters->getShadingPos;
my $getShadingPos =
$FHEM::Automation::ShuttersControl::shutters->getShadingPos;
my $getStatus = $FHEM::Automation::ShuttersControl::shutters->getStatus;
my $oldShadingStatus = $FHEM::Automation::ShuttersControl::shutters->getShadingStatus;
my $oldShadingStatus =
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus;
my $shuttersDevHash = $defs{$shuttersDev};
my $getModeUp = $FHEM::Automation::ShuttersControl::shutters->getModeUp;
@ -254,12 +282,14 @@ sub ShadingProcessing {
if (
(
$outTemp < $FHEM::Automation::ShuttersControl::shutters->getShadingMinOutsideTemperature - 4
$outTemp < $FHEM::Automation::ShuttersControl::shutters
->getShadingMinOutsideTemperature - 4
|| $azimuth < $azimuthLeft
|| $azimuth > $azimuthRight
|| !$FHEM::Automation::ShuttersControl::shutters->getIsDay
)
&& $FHEM::Automation::ShuttersControl::shutters->getShadingStatus ne 'out'
&& $FHEM::Automation::ShuttersControl::shutters->getShadingStatus ne
'out'
)
{
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out');
@ -275,24 +305,36 @@ sub ShadingProcessing {
}
elsif ($azimuth < $azimuthLeft
|| $azimuth > $azimuthRight
|| $elevation < $FHEM::Automation::ShuttersControl::shutters->getShadingMinElevation
|| $elevation > $FHEM::Automation::ShuttersControl::shutters->getShadingMaxElevation
|| $brightness < $FHEM::Automation::ShuttersControl::shutters->getShadingStateChangeCloudy
|| $outTemp < $FHEM::Automation::ShuttersControl::shutters->getShadingMinOutsideTemperature - 1 )
|| $elevation <
$FHEM::Automation::ShuttersControl::shutters->getShadingMinElevation
|| $elevation >
$FHEM::Automation::ShuttersControl::shutters->getShadingMaxElevation
|| $brightness < $FHEM::Automation::ShuttersControl::shutters
->getShadingStateChangeCloudy
|| $outTemp < $FHEM::Automation::ShuttersControl::shutters
->getShadingMinOutsideTemperature - 1 )
{
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out reserved')
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'in'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'in reserved' );
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
'out reserved')
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
'in'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
eq 'in reserved' );
if (
(
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out reserved'
and
( int( gettimeofday() ) - $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp )
) > $FHEM::Automation::ShuttersControl::shutters->getShadingWaitingPeriod
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus
eq 'out reserved'
and (
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp )
) > $FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod
)
{
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out');
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
'out');
}
Log3( $name, 4,
@ -301,35 +343,52 @@ sub ShadingProcessing {
. " In der Out Abfrage, Shadingwert: "
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
. ", Zeitstempel: "
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp );
. $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp );
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessing: '
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. ' - Einer der Beschattungsbedingungen wird nicht mehr erfüllt und somit wird der Beschattungsstatus um eine Stufe reduziert. Alter Status: '
. $oldShadingStatus
. ' Neuer Status: '
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus );
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
);
}
elsif ($azimuth > $azimuthLeft
&& $azimuth < $azimuthRight
&& $elevation > $FHEM::Automation::ShuttersControl::shutters->getShadingMinElevation
&& $elevation < $FHEM::Automation::ShuttersControl::shutters->getShadingMaxElevation
&& $brightness > $FHEM::Automation::ShuttersControl::shutters->getShadingStateChangeSunny
&& $outTemp > $FHEM::Automation::ShuttersControl::shutters->getShadingMinOutsideTemperature )
&& $elevation >
$FHEM::Automation::ShuttersControl::shutters->getShadingMinElevation
&& $elevation <
$FHEM::Automation::ShuttersControl::shutters->getShadingMaxElevation
&& $brightness >
$FHEM::Automation::ShuttersControl::shutters->getShadingStateChangeSunny
&& $outTemp > $FHEM::Automation::ShuttersControl::shutters
->getShadingMinOutsideTemperature )
{
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out reserved' )
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
'out'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
eq 'out reserved' )
{
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('in reserved');
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
'in reserved');
}
if ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'in reserved'
and
( int( gettimeofday() ) - $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp ) >
( $FHEM::Automation::ShuttersControl::shutters->getShadingWaitingPeriod / 2 ) )
if (
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
'in reserved'
and (
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ) > (
$FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod / 2
)
)
{
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('in');
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
'in');
}
Log3( $name, 4,
@ -338,52 +397,75 @@ sub ShadingProcessing {
. " In der In Abfrage, Shadingwert: "
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
. ", Zeitstempel: "
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp );
. $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp );
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessing: '
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. ' - Alle Beschattungsbedingungen wurden erfüllt und somit wird der Beschattungsstatus um eine Stufe angehoben. Alter Status: '
. $oldShadingStatus
. ' Neuer Status: '
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus );
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
);
}
ShadingProcessingDriveCommand( $hash, $shuttersDev )
if (
FHEM::Automation::ShuttersControl::IsAfterShuttersTimeBlocking($shuttersDev)
&& !$FHEM::Automation::ShuttersControl::shutters->getShadingManualDriveStatus
&& $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus ne 'gotosleep'
&& $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus ne 'asleep'
FHEM::Automation::ShuttersControl::IsAfterShuttersTimeBlocking(
$shuttersDev)
&& !$FHEM::Automation::ShuttersControl::shutters
->getShadingManualDriveStatus
&& $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus ne
'gotosleep'
&& $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus ne
'asleep'
&& (
(
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out'
&& $FHEM::Automation::ShuttersControl::shutters->getShadingLastStatus eq 'in'
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus
eq 'out'
&& $FHEM::Automation::ShuttersControl::shutters
->getShadingLastStatus eq 'in'
)
|| ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'in'
&& $FHEM::Automation::ShuttersControl::shutters->getShadingLastStatus eq 'out' )
|| ( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
eq 'in'
&& $FHEM::Automation::ShuttersControl::shutters
->getShadingLastStatus eq 'out' )
)
&& ( $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'always'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq $homemode )
&& ( $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq
'always'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq
$homemode )
&& (
$FHEM::Automation::ShuttersControl::shutters->getModeUp eq 'always'
|| $FHEM::Automation::ShuttersControl::shutters->getModeUp eq $homemode
|| $FHEM::Automation::ShuttersControl::shutters->getModeUp eq
$homemode
|| $FHEM::Automation::ShuttersControl::shutters->getModeUp eq 'off'
|| $FHEM::Automation::ShuttersControl::shutters->getModeUp eq 'absent'
|| ( $FHEM::Automation::ShuttersControl::shutters->getModeUp eq 'home'
|| $FHEM::Automation::ShuttersControl::shutters->getModeUp eq
'absent'
|| ( $FHEM::Automation::ShuttersControl::shutters->getModeUp eq
'home'
&& $homemode ne 'asleep' )
)
&& (
(
(
int( gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp
$FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp
) < 2
&& $FHEM::Automation::ShuttersControl::shutters->getStatus != $FHEM::Automation::ShuttersControl::shutters->getClosedPos
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
$FHEM::Automation::ShuttersControl::shutters->getClosedPos
)
|| (
!$FHEM::Automation::ShuttersControl::shutters
->getQueryShuttersPos(
$FHEM::Automation::ShuttersControl::shutters->getShadingPos
)
&& $FHEM::Automation::ShuttersControl::shutters->getIfInShading
)
|| ( !$FHEM::Automation::ShuttersControl::shutters->getQueryShuttersPos( $FHEM::Automation::ShuttersControl::shutters->getShadingPos )
&& $FHEM::Automation::ShuttersControl::shutters->getIfInShading )
|| ( !$FHEM::Automation::ShuttersControl::shutters->getIfInShading
&& $FHEM::Automation::ShuttersControl::shutters->getStatus == $FHEM::Automation::ShuttersControl::shutters->getShadingPos )
&& $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters->getShadingPos )
)
);
@ -392,16 +474,21 @@ sub ShadingProcessing {
$shuttersDevHash,
'ASC_ShadingMessage',
'INFO: current shading status is \''
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus . '\''
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
. '\''
. ' - next check in '
. (
(
(
$FHEM::Automation::ShuttersControl::shutters->getShadingLastStatus eq 'out reserved'
|| $FHEM::Automation::ShuttersControl::shutters->getShadingLastStatus eq 'out'
$FHEM::Automation::ShuttersControl::shutters
->getShadingLastStatus eq 'out reserved'
|| $FHEM::Automation::ShuttersControl::shutters
->getShadingLastStatus eq 'out'
)
? $FHEM::Automation::ShuttersControl::shutters->getShadingWaitingPeriod
: $FHEM::Automation::ShuttersControl::shutters->getShadingWaitingPeriod / 2
? $FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod
: $FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod / 2
)
) / 60
. 'm'
@ -418,22 +505,31 @@ sub ShadingProcessingDriveCommand {
my $name = $hash->{NAME};
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
my $getShadingPos = $FHEM::Automation::ShuttersControl::shutters->getShadingPos;
my $getShadingPos =
$FHEM::Automation::ShuttersControl::shutters->getShadingPos;
my $getStatus = $FHEM::Automation::ShuttersControl::shutters->getStatus;
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus( $FHEM::Automation::ShuttersControl::shutters->getShadingStatus );
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus(
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus );
if (
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'in'
&& $getShadingPos != $getStatus
&& ( FHEM::Automation::ShuttersControl::CheckIfShuttersWindowRecOpen($shuttersDev) != 2
|| $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace ne 'terrace' )
&& (
FHEM::Automation::ShuttersControl::CheckIfShuttersWindowRecOpen(
$shuttersDev) != 2
|| $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace
ne 'terrace'
)
)
{
$FHEM::Automation::ShuttersControl::shutters->setLastDrive('shading in');
FHEM::Automation::ShuttersControl::ShuttersCommandSet( $hash, $shuttersDev, $getShadingPos );
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
'shading in');
FHEM::Automation::ShuttersControl::ShuttersCommandSet( $hash,
$shuttersDev, $getShadingPos );
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessingDriveCommand: '
FHEM::Automation::ShuttersControl::ASC_Debug(
'ShadingProcessingDriveCommand: '
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. ' - Der aktuelle Beschattungsstatus ist: '
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
@ -441,35 +537,50 @@ sub ShadingProcessingDriveCommand {
. $getShadingPos
. ' zum Beschatten gefahren' );
$FHEM::Automation::ShuttersControl::shutters
->setShadingLastPos($getShadingPos);
$FHEM::Automation::ShuttersControl::shutters->setShadingLastPos(
$getShadingPos);
}
elsif ($FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out'
elsif (
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq 'out'
&& $getShadingPos == $getStatus )
{
$FHEM::Automation::ShuttersControl::shutters->setLastDrive('shading out');
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
'shading out');
FHEM::Automation::ShuttersControl::ShuttersCommandSet(
$hash,
$shuttersDev,
(
($getShadingPos == $FHEM::Automation::ShuttersControl::shutters->getLastPos
|| $getShadingPos == $FHEM::Automation::ShuttersControl::shutters->getShadingLastPos)
(
$getShadingPos ==
$FHEM::Automation::ShuttersControl::shutters->getLastPos
|| $getShadingPos ==
$FHEM::Automation::ShuttersControl::shutters
->getShadingLastPos
)
? $FHEM::Automation::ShuttersControl::shutters->getOpenPos
: (
$FHEM::Automation::ShuttersControl::shutters->getQueryShuttersPos( $FHEM::Automation::ShuttersControl::shutters->getLastPos )
$FHEM::Automation::ShuttersControl::shutters
->getQueryShuttersPos(
$FHEM::Automation::ShuttersControl::shutters->getLastPos
)
? (
$FHEM::Automation::ShuttersControl::shutters->getLastPos == $FHEM::Automation::ShuttersControl::shutters->getSleepPos
? $FHEM::Automation::ShuttersControl::shutters->getOpenPos
: $FHEM::Automation::ShuttersControl::shutters->getLastPos
$FHEM::Automation::ShuttersControl::shutters
->getLastPos ==
$FHEM::Automation::ShuttersControl::shutters
->getSleepPos
? $FHEM::Automation::ShuttersControl::shutters
->getOpenPos
: $FHEM::Automation::ShuttersControl::shutters
->getLastPos
)
: $FHEM::Automation::ShuttersControl::shutters->getOpenPos
)
)
)
if ( $FHEM::Automation::ShuttersControl::shutters->getIsDay );
) if ( $FHEM::Automation::ShuttersControl::shutters->getIsDay );
FHEM::Automation::ShuttersControl::ASC_Debug( 'ShadingProcessingDriveCommand: '
FHEM::Automation::ShuttersControl::ASC_Debug(
'ShadingProcessingDriveCommand: '
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. ' - Der aktuelle Beschattungsstatus ist: '
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
@ -489,14 +600,15 @@ sub ShadingProcessingDriveCommand {
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
. ', Beschattungsstatus Zeitstempel: '
. strftime(
"%Y.%m.%e %T", localtime( $FHEM::Automation::ShuttersControl::shutters->getShadingStatusTimestamp )
"%Y.%m.%e %T",
localtime(
$FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp
)
)
);
return;
}
1;