better logic

This commit is contained in:
Marko Oldenburg 2019-01-02 09:38:00 +01:00
parent b50a8cf464
commit 890c658f2e

View File

@ -178,6 +178,7 @@ my %userAttrList = (
'ASC_Shading_Min_Elevation' => 25.0,
'ASC_Shading_Min_OutsideTemperature' => 18,
'ASC_Shading_WaitingPeriod' => 1200,
# 'ASC_Shading_Fast_Open:on,off' => 'none',
# 'ASC_Shading_Fast_Close:on,off' => 'none',
'ASC_Drive_Offset' => -1,
@ -265,7 +266,6 @@ sub Define($$) {
. ' devStateIcon selfeDefense.terrace:fts_door_tilt created.new.drive.timer:clock .*asleep:scene_sleeping roommate.(awoken|home):user_available residents.(home|awoken):status_available manual:fts_shutter_manual selfeDefense.active:status_locked selfeDefense.inactive:status_open day.open:scene_day night.close:scene_night shading.in:weather_sun shading.out:weather_cloudy'
) if ( AttrVal( $name, 'devStateIcon', 'none' ) eq 'none' );
addToAttrList('ASC:0,1,2');
Log3( $name, 3, "AutoShuttersControl ($name) - defined" );
@ -294,7 +294,6 @@ sub Attr(@) {
my ( $cmd, $name, $attrName, $attrVal ) = @_;
my $hash = $defs{$name};
return undef;
}
@ -1207,6 +1206,7 @@ sub EventProcessingBrightness($@) {
)
and $1 < $brightnessMinVal
and $shutters->getDown eq 'brightness'
and IsAfterShuttersManualBlocking($shuttersDev)
)
{
Log3( $name, 4,
@ -1230,8 +1230,7 @@ sub EventProcessingBrightness($@) {
or $homemode eq 'none'
or $shutters->getModeDown eq 'always' )
{
ShuttersCommandSet( $hash, $shuttersDev,
$posValue );
ShuttersCommandSet( $hash, $shuttersDev, $posValue );
}
else {
EventProcessingShadingBrightness( $hash, $shuttersDev,
@ -1260,9 +1259,13 @@ sub EventProcessingShadingBrightness($@) {
$shutters->getShadingAngleRight
)
if ( ( $shutters->getShadingMode eq 'always'
or $shutters->getShadingMode eq $homemode)
and IsDay( $hash, $shuttersDev ) );
if (
(
$shutters->getShadingMode eq 'always'
or $shutters->getShadingMode eq $homemode
)
and IsDay( $hash, $shuttersDev )
);
}
}
@ -1478,11 +1481,7 @@ sub EventProcessingPartyMode($) {
}
elsif ( IsDay( $hash, $shuttersDev ) ) {
$shutters->setLastDrive('drive after party mode');
ShuttersCommandSet(
$hash,
$shuttersDev,
$shutters->getDelayCmd
);
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getDelayCmd );
}
}
}
@ -1721,11 +1720,14 @@ sub SunSetShuttersAfterTimerFn($) {
$homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' );
if (
(
$shutters->getModeDown eq $homemode
or ( $shutters->getModeDown eq 'absent'
and $homemode eq 'gone' )
or $shutters->getModeDown eq 'always'
)
and IsAfterShuttersManualBlocking($shuttersDev)
)
{
$shutters->setLastDrive('night close');
ShuttersCommandSet( $hash, $shuttersDev, $posValue );
@ -2228,10 +2230,8 @@ sub IsAfterShuttersManualBlocking($) {
my $shuttersDev = shift;
$shutters->setShuttersDev($shuttersDev);
if (
( int( gettimeofday() ) - $shutters->getLastManPosTimestamp ) <
$shutters->getBlockingTimeAfterManual
)
if ( ( int( gettimeofday() ) - $shutters->getLastManPosTimestamp ) <
$shutters->getBlockingTimeAfterManual )
{
return 0;
}