Merge branch 'dev' into patch_issues73-DriveUpDriveDownRoommate

This commit is contained in:
Marko Oldenburg 2021-12-11 14:24:14 +01:00
commit 4aa24587a5
3 changed files with 215 additions and 166 deletions

View File

@ -1,10 +1,10 @@
UPD 2021-12-04_08:08:23 115678 FHEM/73_AutoShuttersControl.pm UPD 2021-12-06_06:34:51 115678 FHEM/73_AutoShuttersControl.pm
UPD 2021-11-29_15:01:56 75264 lib/FHEM/Automation/ShuttersControl.pm UPD 2021-11-29_15:01:56 75264 lib/FHEM/Automation/ShuttersControl.pm
UPD 2021-10-09_07:12:54 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2021-10-09_07:12:54 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm
UPD 2021-10-09_07:12:54 2494 lib/FHEM/Automation/ShuttersControl/Roommate.pm UPD 2021-10-09_07:12:54 2494 lib/FHEM/Automation/ShuttersControl/Roommate.pm
UPD 2021-10-24_07:33:53 31900 lib/FHEM/Automation/ShuttersControl/Shutters.pm UPD 2021-10-24_07:33:53 31900 lib/FHEM/Automation/ShuttersControl/Shutters.pm
UPD 2021-12-04_09:50:00 25333 lib/FHEM/Automation/ShuttersControl/Shading.pm UPD 2021-12-11_14:23:02 25126 lib/FHEM/Automation/ShuttersControl/Shading.pm
UPD 2021-12-04_10:56:34 110417 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm UPD 2021-12-11_14:23:02 112344 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm
UPD 2021-11-14_14:03:06 40094 lib/FHEM/Automation/ShuttersControl/Helper.pm UPD 2021-11-14_14:03:06 40094 lib/FHEM/Automation/ShuttersControl/Helper.pm
UPD 2021-10-09_07:12:54 2173 lib/FHEM/Automation/ShuttersControl/Window.pm UPD 2021-10-09_07:12:54 2173 lib/FHEM/Automation/ShuttersControl/Window.pm
UPD 2021-10-09_07:12:54 11739 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm UPD 2021-10-09_07:12:54 11739 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
@ -13,4 +13,4 @@ UPD 2021-10-27_08:50:46 52649 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.
UPD 2021-10-09_07:12:54 2901 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2021-10-09_07:12:54 2901 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm
UPD 2021-10-09_07:12:54 3978 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2021-10-09_07:12:54 3978 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm
UPD 2021-10-09_07:12:54 2286 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm UPD 2021-10-09_07:12:54 2286 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm
UPD 2021-11-25_08:28:33 6965 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm UPD 2021-12-06_06:34:51 6965 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm

View File

@ -54,18 +54,18 @@ use FHEM::Automation::ShuttersControl::Rainprotection qw (:ALL);
require Exporter; require Exporter;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT_OK = qw( our @EXPORT_OK = qw(
EventProcessingPartyMode EventProcessingPartyMode
EventProcessingGeneral EventProcessingGeneral
EventProcessingShutters EventProcessingShutters
EventProcessingAdvShuttersClose EventProcessingAdvShuttersClose
); );
our %EXPORT_TAGS = ( our %EXPORT_TAGS = (
ALL => [ ALL => [
qw( qw(
EventProcessingPartyMode EventProcessingPartyMode
EventProcessingGeneral EventProcessingGeneral
EventProcessingShutters EventProcessingShutters
EventProcessingAdvShuttersClose EventProcessingAdvShuttersClose
) )
], ],
); );
@ -75,12 +75,12 @@ use GPUtils qw(GP_Import);
BEGIN { BEGIN {
GP_Import( GP_Import(
qw( qw(
Log3 Log3
gettimeofday gettimeofday
computeAlignTime computeAlignTime
CommandSet CommandSet
ReadingsVal ReadingsVal
RemoveInternalTimer RemoveInternalTimer
) )
); );
} }
@ -94,8 +94,12 @@ sub EventProcessingGeneral {
if ( defined($devname) && ($devname) ) if ( defined($devname) && ($devname) )
{ # es wird lediglich der Devicename der Funktion mitgegeben wenn es sich nicht um global handelt daher hier die Unterscheidung { # es wird lediglich der Devicename der Funktion mitgegeben wenn es sich nicht um global handelt daher hier die Unterscheidung
my $windReading = $FHEM::Automation::ShuttersControl::ascDev->getWindSensorReading // 'none'; my $windReading =
my $rainReading = $FHEM::Automation::ShuttersControl::ascDev->getRainSensorReading // 'none'; $FHEM::Automation::ShuttersControl::ascDev->getWindSensorReading
// 'none';
my $rainReading =
$FHEM::Automation::ShuttersControl::ascDev->getRainSensorReading
// 'none';
while ( my ( $device, $deviceAttr ) = while ( my ( $device, $deviceAttr ) =
each %{ $hash->{monitoredDevs}{$devname} } ) each %{ $hash->{monitoredDevs}{$devname} } )
@ -122,13 +126,16 @@ sub EventProcessingGeneral {
EventProcessingExternalTriggerDevice( $hash, $device, $events ) EventProcessingExternalTriggerDevice( $hash, $device, $events )
if ( $deviceAttr eq 'ASC_ExternalTrigger' ); if ( $deviceAttr eq 'ASC_ExternalTrigger' );
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($device) $FHEM::Automation::ShuttersControl::shutters->setShuttersDev(
$device)
if ( $deviceAttr eq 'ASC_BrightnessSensor' ); if ( $deviceAttr eq 'ASC_BrightnessSensor' );
if ( if (
$deviceAttr eq 'ASC_BrightnessSensor' $deviceAttr eq 'ASC_BrightnessSensor'
&& ( $FHEM::Automation::ShuttersControl::shutters->getDown eq 'brightness' && ( $FHEM::Automation::ShuttersControl::shutters->getDown eq
|| $FHEM::Automation::ShuttersControl::shutters->getUp eq 'brightness' ) 'brightness'
|| $FHEM::Automation::ShuttersControl::shutters->getUp eq
'brightness' )
) )
{ {
EventProcessingBrightness( $hash, $device, $events ); EventProcessingBrightness( $hash, $device, $events );
@ -147,7 +154,8 @@ sub EventProcessingGeneral {
\s(.*)$}xms \s(.*)$}xms
) )
{ # wurde den Attributen unserer Rolläden ein Wert zugewiesen ? { # wurde den Attributen unserer Rolläden ein Wert zugewiesen ?
FHEM::Automation::ShuttersControl::AddNotifyDev( $hash, $3, $1, $2 ) if ( $3 ne 'none' ); FHEM::Automation::ShuttersControl::AddNotifyDev( $hash, $3, $1, $2 )
if ( $3 ne 'none' );
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - EventProcessing: ATTR" ); "AutoShuttersControl ($name) - EventProcessing: ATTR" );
} }
@ -175,11 +183,13 @@ sub EventProcessingGeneral {
(.*)?}xms (.*)?}xms
) )
{ {
FHEM::Automation::ShuttersControl::CreateSunRiseSetShuttersTimer( $hash, $2 ) FHEM::Automation::ShuttersControl::CreateSunRiseSetShuttersTimer(
$hash, $2 )
if ( if (
$3 ne 'ASC_Time_Up_WE_Holiday' $3 ne 'ASC_Time_Up_WE_Holiday'
|| ( $3 eq 'ASC_Time_Up_WE_Holiday' || ( $3 eq 'ASC_Time_Up_WE_Holiday'
&& $FHEM::Automation::ShuttersControl::ascDev->getSunriseTimeWeHoliday eq 'on' ) && $FHEM::Automation::ShuttersControl::ascDev
->getSunriseTimeWeHoliday eq 'on' )
); );
} }
elsif ( elsif (
@ -189,7 +199,8 @@ sub EventProcessingGeneral {
(.*)?}xms (.*)?}xms
) )
{ {
FHEM::Automation::ShuttersControl::RenewSunRiseSetShuttersTimer($hash); FHEM::Automation::ShuttersControl::RenewSunRiseSetShuttersTimer(
$hash);
} }
elsif ( elsif (
$events =~ m{^(DELETEATTR|ATTR) $events =~ m{^(DELETEATTR|ATTR)
@ -197,7 +208,8 @@ sub EventProcessingGeneral {
(.*)?}xms (.*)?}xms
) )
{ {
$FHEM::Automation::ShuttersControl::shutters->deleteShadingStateChangeSunny; $FHEM::Automation::ShuttersControl::shutters
->deleteShadingStateChangeSunny;
} }
if ( if (
@ -210,20 +222,21 @@ m{^(DELETEATTR|ATTR) #global ATTR myASC ASC_tempSensor Cellar
(.*)?}xms (.*)?}xms
) )
{ {
# ATTR RolloKinZimSteven_F1 ASC_Shading_Mode off # ATTR RolloKinZimSteven_F1 ASC_Shading_Mode off
if ( $events =~ m{^ATTR\s(.*)\sASC_Shading_Mode\s(off)}xms ) { if ( $events =~ m{^ATTR\s(.*)\sASC_Shading_Mode\s(off)}xms ) {
my %funcHash = ( my %funcHash = (
hash => $hash, hash => $hash,
shuttersdevice => $1, shuttersdevice => $1,
value => $2, value => $2,
attrEvent => 1, attrEvent => 1,
); );
FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn(\%funcHash); FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn(
\%funcHash );
} }
else { else {
CommandSet( undef, $name . ' controlShading on' ) CommandSet( undef, $name . ' controlShading on' )
if ( ReadingsVal( $name, 'controlShading', 'off' ) ne 'off' ); if ( ReadingsVal( $name, 'controlShading', 'off' ) ne 'off' );
} }
} }
} }
@ -243,9 +256,16 @@ sub EventProcessingWindowRec {
$FHEM::Automation::ShuttersControl::shutters->getWinDevReading; $FHEM::Automation::ShuttersControl::shutters->getWinDevReading;
if ( $events =~ if ( $events =~
m{.*$reading:.*?([Oo]pen(?>ed)?|[Cc]losed?|tilt(?>ed)?|true|false)}xms m{.*$reading:.*?([Oo]pen(?>ed)?|[Cc]losed?|tilt(?>ed)?|true|false)}xms )
&& IsAfterShuttersManualBlocking($shuttersDev) )
{ {
return
if ( !IsAfterShuttersManualBlocking($shuttersDev)
&& ( $FHEM::Automation::ShuttersControl::shutters->getLockOut eq
'off'
|| $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace
ne 'terrace' )
);
my $match = $1; my $match = $1;
FHEM::Automation::ShuttersControl::ASC_Debug( FHEM::Automation::ShuttersControl::ASC_Debug(
@ -260,11 +280,7 @@ sub EventProcessingWindowRec {
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev( $FHEM::Automation::ShuttersControl::shutters->setShuttersDev(
$shuttersDev); $shuttersDev);
my $homemode =
$FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus;
$homemode =
$FHEM::Automation::ShuttersControl::ascDev->getResidentsStatus
if ( $homemode eq 'none' );
#### Hardware Lock der Rollläden #### Hardware Lock der Rollläden
$FHEM::Automation::ShuttersControl::shutters->setHardLockOut('off') $FHEM::Automation::ShuttersControl::shutters->setHardLockOut('off')
@ -272,9 +288,29 @@ sub EventProcessingWindowRec {
&& $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace && $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace
eq 'terrace' ); eq 'terrace' );
$FHEM::Automation::ShuttersControl::shutters->setHardLockOut('on') $FHEM::Automation::ShuttersControl::shutters->setHardLockOut('on')
if ( $match =~ m{[Oo]pen|false}xms if (
$match =~ m{[Oo]pen|false}xms
&& $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace && $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace
eq 'terrace' ); eq 'terrace'
&& ( $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters->getOpenPos
|| $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos
)
);
return
if ( !IsAfterShuttersManualBlocking($shuttersDev) );
my $homemode =
$FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus;
$homemode =
$FHEM::Automation::ShuttersControl::ascDev->getResidentsStatus
if ( $homemode eq 'none' );
FHEM::Automation::ShuttersControl::ASC_Debug( FHEM::Automation::ShuttersControl::ASC_Debug(
'EventProcessingWindowRec: ' 'EventProcessingWindowRec: '
@ -283,12 +319,12 @@ sub EventProcessingWindowRec {
. $homemode . $homemode
. ' QueryShuttersPosWinRecTilted:' . ' QueryShuttersPosWinRecTilted:'
. $FHEM::Automation::ShuttersControl::shutters . $FHEM::Automation::ShuttersControl::shutters
->getQueryShuttersPos( ->getQueryShuttersPos(
$FHEM::Automation::ShuttersControl::shutters->getVentilatePos $FHEM::Automation::ShuttersControl::shutters->getVentilatePos
) )
. ' QueryShuttersPosWinRecComfort: ' . ' QueryShuttersPosWinRecComfort: '
. $FHEM::Automation::ShuttersControl::shutters . $FHEM::Automation::ShuttersControl::shutters
->getQueryShuttersPos( ->getQueryShuttersPos(
$FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos $FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos
) )
); );
@ -301,41 +337,40 @@ sub EventProcessingWindowRec {
$FHEM::Automation::ShuttersControl::shutters->getVentilatePos $FHEM::Automation::ShuttersControl::shutters->getVentilatePos
|| $FHEM::Automation::ShuttersControl::shutters->getStatus == || $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos $FHEM::Automation::ShuttersControl::shutters->getComfortOpenPos
|| ( $FHEM::Automation::ShuttersControl::shutters->getStatus == || ( $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters->getOpenPos $FHEM::Automation::ShuttersControl::shutters->getOpenPos
&& $FHEM::Automation::ShuttersControl::shutters->getLastDrive && $FHEM::Automation::ShuttersControl::shutters
eq 'ventilate - window open' ->getLastDrive eq 'ventilate - window open'
&& $FHEM::Automation::ShuttersControl::shutters->getSubTyp && $FHEM::Automation::ShuttersControl::shutters->getSubTyp
eq 'twostate' eq 'twostate'
&& $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen && $FHEM::Automation::ShuttersControl::shutters
eq 'on' ) ->getVentilateOpen eq 'on' )
|| ( $FHEM::Automation::ShuttersControl::shutters->getStatus == || ( $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getPrivacyDownPos ->getPrivacyDownPos
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getPrivacyDownStatus != 2 ->getPrivacyDownStatus != 2
&& !$FHEM::Automation::ShuttersControl::shutters->getIsDay ) && !$FHEM::Automation::ShuttersControl::shutters->getIsDay )
|| ( $FHEM::Automation::ShuttersControl::shutters->getStatus == || (
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters->getStatus ==
->getOpenPos $FHEM::Automation::ShuttersControl::shutters->getOpenPos
&& ( $FHEM::Automation::ShuttersControl::shutters && ( $FHEM::Automation::ShuttersControl::shutters
->getLockOut ne 'off' ->getLockOut ne 'off'
|| $FHEM::Automation::ShuttersControl::shutters || $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'terrace' ->getShuttersPlace eq 'terrace' )
) && !$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& !$FHEM::Automation::ShuttersControl::shutters->getIsDay ) )
|| ( $FHEM::Automation::ShuttersControl::shutters->getStatus == || ( $FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters->getOpenPos
->getOpenPos
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getDelayCmd ne 'none' ->getDelayCmd ne 'none'
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'terrace' ) ->getShuttersPlace eq 'terrace' )
) )
&& ( $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen && ( $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen
eq 'on' eq 'on'
|| $FHEM::Automation::ShuttersControl::ascDev || $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlComfort eq 'on' ) ->getAutoShuttersControlComfort eq 'on' )
) )
{ {
FHEM::Automation::ShuttersControl::ASC_Debug( FHEM::Automation::ShuttersControl::ASC_Debug(
@ -371,18 +406,19 @@ sub EventProcessingWindowRec {
elsif ( elsif (
!$FHEM::Automation::ShuttersControl::shutters !$FHEM::Automation::ShuttersControl::shutters
->getIfInShading ->getIfInShading
&& ( $FHEM::Automation::ShuttersControl::shutters->getStatus && (
$FHEM::Automation::ShuttersControl::shutters->getStatus
!= $FHEM::Automation::ShuttersControl::shutters != $FHEM::Automation::ShuttersControl::shutters
->getOpenPos ->getOpenPos
|| $FHEM::Automation::ShuttersControl::shutters || $FHEM::Automation::ShuttersControl::shutters
->getStatus != ->getStatus !=
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getLastManPos ->getLastManPos
|| ( $FHEM::Automation::ShuttersControl::shutters || ( $FHEM::Automation::ShuttersControl::shutters
->getDelayCmd ne 'none' ->getDelayCmd ne 'none'
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'terrace' ) ->getShuttersPlace eq 'terrace' )
) )
) )
{ {
if ( $FHEM::Automation::ShuttersControl::shutters if ( $FHEM::Automation::ShuttersControl::shutters
@ -407,40 +443,44 @@ sub EventProcessingWindowRec {
->setDriveCmd( ->setDriveCmd(
( (
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getDelayCmd ne 'none' ->getDelayCmd ne 'none'
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'terrace' ->getShuttersPlace eq 'terrace'
? $FHEM::Automation::ShuttersControl::shutters ? $FHEM::Automation::ShuttersControl::shutters
->getDelayCmd ->getDelayCmd
: ( $FHEM::Automation::ShuttersControl::shutters : (
$FHEM::Automation::ShuttersControl::shutters
->getVentilatePosAfterDayClosed eq 'open' ->getVentilatePosAfterDayClosed eq 'open'
? $FHEM::Automation::ShuttersControl::shutters ? $FHEM::Automation::ShuttersControl::shutters
->getOpenPos ->getOpenPos
: $FHEM::Automation::ShuttersControl::shutters : $FHEM::Automation::ShuttersControl::shutters
->getLastManPos ) ->getLastManPos
)
) )
); );
} }
} }
} }
elsif ( elsif (
!$FHEM::Automation::ShuttersControl::shutters->getIsDay !$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& $FHEM::Automation::ShuttersControl::shutters->getModeDown eq 'roommate' && $FHEM::Automation::ShuttersControl::shutters->getModeDown eq
&& ( $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus eq 'home' 'roommate'
|| $FHEM::Automation::ShuttersControl::shutters->getRoommatesStatus eq 'awoken' ) && ( $FHEM::Automation::ShuttersControl::shutters
->getRoommatesStatus eq 'home'
|| $FHEM::Automation::ShuttersControl::shutters
->getRoommatesStatus eq 'awoken' )
) )
{ {
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
->setDriveCmd( (
( $FHEM::Automation::ShuttersControl::shutters
$FHEM::Automation::ShuttersControl::shutters ->getVentilatePosAfterDayClosed eq 'open'
->getVentilatePosAfterDayClosed eq 'open' ? $FHEM::Automation::ShuttersControl::shutters
? $FHEM::Automation::ShuttersControl::shutters ->getOpenPos
->getOpenPos : $FHEM::Automation::ShuttersControl::shutters
: $FHEM::Automation::ShuttersControl::shutters ->getLastManPos
->getLastManPos )
) );
);
} }
elsif ( elsif (
$FHEM::Automation::ShuttersControl::shutters->getModeDown ne $FHEM::Automation::ShuttersControl::shutters->getModeDown ne
@ -495,9 +535,11 @@ sub EventProcessingWindowRec {
) )
&& $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen && $FHEM::Automation::ShuttersControl::shutters->getVentilateOpen
eq 'on' eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters && ( $FHEM::Automation::ShuttersControl::shutters
->getQueryShuttersPos( ->getQueryShuttersPos(
$FHEM::Automation::ShuttersControl::shutters->getVentilatePos $FHEM::Automation::ShuttersControl::shutters->getVentilatePos)
|| ( $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace eq 'terrace'
&& $FHEM::Automation::ShuttersControl::shutters->getSubTyp eq 'twostate' )
) )
) )
{ {
@ -824,7 +866,7 @@ sub EventProcessingRoommate {
elsif ( elsif (
( $event eq 'gotosleep' || $event eq 'asleep' ) ( $event eq 'gotosleep' || $event eq 'asleep' )
&& $FHEM::Automation::ShuttersControl::shutters->getModeDown ne && $FHEM::Automation::ShuttersControl::shutters->getModeDown ne
'absent' 'absent'
&& ( $FHEM::Automation::ShuttersControl::ascDev && ( $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlEvening eq 'on' ->getAutoShuttersControlEvening eq 'on'
|| $getDown eq || $getDown eq
@ -974,6 +1016,7 @@ sub EventProcessingResidents {
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getSelfDefenseMode ne 'off' ->getSelfDefenseMode ne 'off'
|| $getModeDown eq 'absent' || $getModeDown eq 'absent'
# || $getModeDown eq 'always' ) Wird zu Testzwecken auskommentiert, siehe #90 Github # || $getModeDown eq 'always' ) Wird zu Testzwecken auskommentiert, siehe #90 Github
|| ( $FHEM::Automation::ShuttersControl::shutters || ( $FHEM::Automation::ShuttersControl::shutters
->getShadingMode eq 'absent' ->getShadingMode eq 'absent'
@ -991,15 +1034,17 @@ sub EventProcessingResidents {
&& ( && (
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getSelfDefenseMode eq 'absent' ->getSelfDefenseMode eq 'absent'
|| ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 || (
CheckIfShuttersWindowRecOpen($shuttersDev) == 2
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getSelfDefenseMode eq 'gone' ->getSelfDefenseMode eq 'gone'
&& ( $FHEM::Automation::ShuttersControl::shutters && ( $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'terrace' ->getShuttersPlace eq 'terrace'
|| $FHEM::Automation::ShuttersControl::shutters || $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'EG_window' ) ->getShuttersPlace eq 'EG_window' )
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getSelfDefenseMode ne 'off' ) ->getSelfDefenseMode ne 'off'
)
) )
) )
{ {
@ -1050,11 +1095,14 @@ sub EventProcessingResidents {
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getLastPos ); ->getLastPos );
} }
elsif ( $getModeDown eq 'absent' # || $getModeDown eq 'always' ) Wird zu Testzwecken auskommentiert, siehe #90 Github elsif (
$getModeDown eq
'absent' # || $getModeDown eq 'always' ) Wird zu Testzwecken auskommentiert, siehe #90 Github
&& !$FHEM::Automation::ShuttersControl::shutters->getIsDay && !$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& IsAfterShuttersTimeBlocking($shuttersDev) && IsAfterShuttersTimeBlocking($shuttersDev)
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getRoommatesStatus eq 'none' ) ->getRoommatesStatus eq 'none'
)
{ {
$FHEM::Automation::ShuttersControl::shutters->setLastDrive( $FHEM::Automation::ShuttersControl::shutters->setLastDrive(
'residents absent'); 'residents absent');
@ -1114,7 +1162,8 @@ sub EventProcessingResidents {
->getRoommatesStatus eq 'none' ->getRoommatesStatus eq 'none'
&& ( $getModeDown eq 'home' && ( $getModeDown eq 'home'
|| $getModeDown eq 'always' ) || $getModeDown eq 'always' )
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlEvening eq 'on' && $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlEvening eq 'on'
&& $getResidentsLastStatus ne 'asleep' && $getResidentsLastStatus ne 'asleep'
&& $getResidentsLastStatus ne 'awoken' && $getResidentsLastStatus ne 'awoken'
&& IsAfterShuttersTimeBlocking($shuttersDev) && IsAfterShuttersTimeBlocking($shuttersDev)
@ -1262,7 +1311,8 @@ sub EventProcessingResidents {
->getRoommatesStatus eq 'none' ->getRoommatesStatus eq 'none'
&& ( $getModeUp eq 'home' && ( $getModeUp eq 'home'
|| $getModeUp eq 'always' ) || $getModeUp eq 'always' )
&& $FHEM::Automation::ShuttersControl::ascDev->getAutoShuttersControlMorning eq 'on' && $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlMorning eq 'on'
&& IsAfterShuttersTimeBlocking($shuttersDev) && IsAfterShuttersTimeBlocking($shuttersDev)
&& !$FHEM::Automation::ShuttersControl::shutters->getIfInShading && !$FHEM::Automation::ShuttersControl::shutters->getIfInShading
&& !$FHEM::Automation::ShuttersControl::shutters && !$FHEM::Automation::ShuttersControl::shutters
@ -1381,8 +1431,9 @@ sub EventProcessingWind {
$FHEM::Automation::ShuttersControl::shutters->getIsDay $FHEM::Automation::ShuttersControl::shutters->getIsDay
? $FHEM::Automation::ShuttersControl::shutters ? $FHEM::Automation::ShuttersControl::shutters
->getLastPos ->getLastPos
: ( $FHEM::Automation::ShuttersControl::shutters->getShuttersPlace : (
eq 'awning' $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'awning'
? $FHEM::Automation::ShuttersControl::shutters ? $FHEM::Automation::ShuttersControl::shutters
->getOpenPos ->getOpenPos
: ( : (
@ -1793,7 +1844,8 @@ sub EventProcessingBrightness {
. $FHEM::Automation::ShuttersControl::shutters . $FHEM::Automation::ShuttersControl::shutters
->getLastDrive ); ->getLastDrive );
FHEM::Automation::ShuttersControl::CreateSunRiseSetShuttersTimer( $hash, $shuttersDev ); FHEM::Automation::ShuttersControl::CreateSunRiseSetShuttersTimer(
$hash, $shuttersDev );
} }
else { else {
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
@ -1970,10 +2022,8 @@ sub EventProcessingBrightness {
$FHEM::Automation::ShuttersControl::shutters->setLastDrive( $FHEM::Automation::ShuttersControl::shutters->setLastDrive(
$lastDrive); $lastDrive);
if ( if ( $FHEM::Automation::ShuttersControl::shutters
$FHEM::Automation::ShuttersControl::shutters ->getPrivacyDownStatus != 2 )
->getPrivacyDownStatus != 2
)
{ {
$FHEM::Automation::ShuttersControl::shutters->setSunrise(0); $FHEM::Automation::ShuttersControl::shutters->setSunrise(0);
$FHEM::Automation::ShuttersControl::shutters->setSunset(1); $FHEM::Automation::ShuttersControl::shutters->setSunset(1);
@ -2163,17 +2213,17 @@ sub EventProcessingTwilightDevice {
. $FHEM::Automation::ShuttersControl::shutters->getShuttersDev . $FHEM::Automation::ShuttersControl::shutters->getShuttersDev
. ' RainProtection: ' . ' RainProtection: '
. $FHEM::Automation::ShuttersControl::shutters . $FHEM::Automation::ShuttersControl::shutters
->getRainProtectionStatus ->getRainProtectionStatus
. ' WindProtection: ' . ' WindProtection: '
. $FHEM::Automation::ShuttersControl::shutters . $FHEM::Automation::ShuttersControl::shutters
->getWindProtectionStatus ); ->getWindProtectionStatus );
if ( $FHEM::Automation::ShuttersControl::ascDev if ( $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading eq 'on' ->getAutoShuttersControlShading eq 'on'
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getRainProtectionStatus eq 'unprotected' ->getRainProtectionStatus eq 'unprotected'
&& $FHEM::Automation::ShuttersControl::shutters && $FHEM::Automation::ShuttersControl::shutters
->getWindProtectionStatus eq 'unprotected' ) ->getWindProtectionStatus eq 'unprotected' )
{ {
ShadingProcessing( ShadingProcessing(
$hash, $hash,
@ -2242,12 +2292,14 @@ sub EventProcessingPartyMode {
$shuttersDev, $shuttersDev,
( (
CheckIfShuttersWindowRecOpen($shuttersDev) == 0 CheckIfShuttersWindowRecOpen($shuttersDev) == 0
? ($FHEM::Automation::ShuttersControl::shutters ? (
$FHEM::Automation::ShuttersControl::shutters
->getSleepPos > 0 ->getSleepPos > 0
? $FHEM::Automation::ShuttersControl::shutters ? $FHEM::Automation::ShuttersControl::shutters
->getSleepPos ->getSleepPos
: $FHEM::Automation::ShuttersControl::shutters : $FHEM::Automation::ShuttersControl::shutters
->getClosedPos) ->getClosedPos
)
: $FHEM::Automation::ShuttersControl::shutters : $FHEM::Automation::ShuttersControl::shutters
->getVentilatePos ->getVentilatePos
) )
@ -2255,7 +2307,7 @@ sub EventProcessingPartyMode {
} }
} }
elsif ( elsif (
$FHEM::Automation::ShuttersControl::shutters->getDelayCmd ne 'none' $FHEM::Automation::ShuttersControl::shutters->getDelayCmd ne 'none'
&& $FHEM::Automation::ShuttersControl::shutters->getIsDay && $FHEM::Automation::ShuttersControl::shutters->getIsDay
&& IsAfterShuttersManualBlocking($shuttersDev) ) && IsAfterShuttersManualBlocking($shuttersDev) )
{ {
@ -2367,6 +2419,22 @@ sub EventProcessingShutters {
$FHEM::Automation::ShuttersControl::shutters->setLastDriveReading; $FHEM::Automation::ShuttersControl::shutters->setLastDriveReading;
$FHEM::Automation::ShuttersControl::ascDev->setStateReading; $FHEM::Automation::ShuttersControl::ascDev->setStateReading;
$FHEM::Automation::ShuttersControl::shutters->setHardLockOut('on')
if (
(
$FHEM::Automation::ShuttersControl::shutters->getStatus ==
$FHEM::Automation::ShuttersControl::shutters
->getComfortOpenPos
|| ( $FHEM::Automation::ShuttersControl::shutters->getStatus
== $FHEM::Automation::ShuttersControl::shutters
->getOpenPos
&& $FHEM::Automation::ShuttersControl::shutters
->getLastDrive eq 'ventilate - window open' )
)
&& $FHEM::Automation::ShuttersControl::shutters
->getShuttersPlace eq 'terrace'
);
FHEM::Automation::ShuttersControl::ASC_Debug( FHEM::Automation::ShuttersControl::ASC_Debug(
'EventProcessingShutters: eine automatisierte Fahrt durch ASC wurde erkannt! Es werden nun die LastDriveReading und StateReading Werte gesetzt!' 'EventProcessingShutters: eine automatisierte Fahrt durch ASC wurde erkannt! Es werden nun die LastDriveReading und StateReading Werte gesetzt!'
); );
@ -2479,7 +2547,4 @@ sub EventProcessingExternalTriggerDevice {
return; return;
} }
1; 1;

View File

@ -64,23 +64,6 @@ our %EXPORT_TAGS = (
], ],
); );
use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
BEGIN {
GP_Import(
qw(
Log3
gettimeofday
InternalTimer
ReadingsVal
readingsBeginUpdate
readingsBulkUpdate
readingsBulkUpdateIfChanged
readingsEndUpdate
defs
)
);
}
sub CheckASC_ConditionsForShadingFn { sub CheckASC_ConditionsForShadingFn {
my $hash = shift; my $hash = shift;
@ -104,8 +87,8 @@ sub CheckASC_ConditionsForShadingFn {
attrEvent => 0, attrEvent => 0,
); );
InternalTimer( ::InternalTimer(
gettimeofday() + $count, ::gettimeofday() + $count,
'FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn', 'FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn',
\%funcHash \%funcHash
); );
@ -128,7 +111,7 @@ sub _CheckShuttersConditionsForShadingFn {
my $value = $funcHash->{value}; my $value = $funcHash->{value};
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev); $FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
my $shuttersDevHash = $defs{$shuttersDev}; my $shuttersDevHash = $::defs{$shuttersDev};
my $message = ''; my $message = '';
my $errorMessage; my $errorMessage;
my $warnMessage; my $warnMessage;
@ -167,9 +150,9 @@ sub _CheckShuttersConditionsForShadingFn {
? ' ASC_Shading_Mode attribut is set but global shading has errors, look at ASC device ' ? ' ASC_Shading_Mode attribut is set but global shading has errors, look at ASC device '
. '<a href="' . '<a href="'
. '/fhem?detail=' . '/fhem?detail='
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' ) . ::ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
. $::FW_CSRF . '">' . $::FW_CSRF . '">'
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' ) . ::ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
. '</a>' . '</a>'
: '' : ''
); );
@ -197,10 +180,10 @@ sub _CheckShuttersConditionsForShadingFn {
&& $infoMessage ne '' && $infoMessage ne ''
&& $errorMessage eq '' ); && $errorMessage eq '' );
readingsBeginUpdate($shuttersDevHash); ::readingsBeginUpdate($shuttersDevHash);
readingsBulkUpdateIfChanged( $shuttersDevHash, 'ASC_ShadingMessage', ::readingsBulkUpdateIfChanged( $shuttersDevHash, 'ASC_ShadingMessage',
'<html>' . $message . ' </html>' ); '<html>' . $message . ' </html>' );
readingsEndUpdate( $shuttersDevHash, 1 ); ::readingsEndUpdate( $shuttersDevHash, 1 );
} }
sub ShadingProcessing { sub ShadingProcessing {
@ -250,7 +233,7 @@ sub ShadingProcessing {
. ', Ist es nach der Hälfte der Beschattungswartezeit: ' . ', Ist es nach der Hälfte der Beschattungswartezeit: '
. ( . (
( (
int( gettimeofday() ) - int( ::gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ->getShadingStatusTimestamp
) < ( ) < (
@ -260,7 +243,7 @@ sub ShadingProcessing {
) )
); );
Log3( $name, 4, ::Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " "AutoShuttersControl ($name) - Shading Processing, Rollladen: "
. $shuttersDev . $shuttersDev
. " Azimuth: " . " Azimuth: "
@ -279,18 +262,19 @@ sub ShadingProcessing {
|| $brightness == -1 || $brightness == -1
|| $outTemp == -100 || $outTemp == -100
|| ( || (
int( gettimeofday() ) - int( ::gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ) < ( ->getShadingStatusTimestamp ) < (
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getShadingWaitingPeriod / 2 ->getShadingWaitingPeriod / 2
) )
|| $FHEM::Automation::ShuttersControl::shutters->getExternalTriggerStatus
|| $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off' || $FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
|| $FHEM::Automation::ShuttersControl::ascDev || $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading eq 'off' ->getAutoShuttersControlShading eq 'off'
); );
Log3( $name, 4, ::Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " "AutoShuttersControl ($name) - Shading Processing, Rollladen: "
. $shuttersDev . $shuttersDev
. " Nach dem return" ); . " Nach dem return" );
@ -300,7 +284,7 @@ sub ShadingProcessing {
my $getStatus = $FHEM::Automation::ShuttersControl::shutters->getStatus; my $getStatus = $FHEM::Automation::ShuttersControl::shutters->getStatus;
my $oldShadingStatus = my $oldShadingStatus =
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus; $FHEM::Automation::ShuttersControl::shutters->getShadingStatus;
my $shuttersDevHash = $defs{$shuttersDev}; my $shuttersDevHash = $::defs{$shuttersDev};
my $getModeUp = $FHEM::Automation::ShuttersControl::shutters->getModeUp; my $getModeUp = $FHEM::Automation::ShuttersControl::shutters->getModeUp;
my $homemode = $FHEM::Automation::ShuttersControl::shutters->getHomemode; my $homemode = $FHEM::Automation::ShuttersControl::shutters->getHomemode;
@ -318,7 +302,7 @@ sub ShadingProcessing {
|| $azimuth > $azimuthRight || $azimuth > $azimuthRight
|| ( !$FHEM::Automation::ShuttersControl::shutters->getIsDay || ( !$FHEM::Automation::ShuttersControl::shutters->getIsDay
&& $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime && $FHEM::Automation::ShuttersControl::shutters->getSunriseUnixTime
- ( int( gettimeofday() ) ) > 7200 ) - ( int( ::gettimeofday() ) ) > 7200 )
) )
&& $FHEM::Automation::ShuttersControl::shutters->getShadingStatus ne && $FHEM::Automation::ShuttersControl::shutters->getShadingStatus ne
'out' 'out'
@ -331,7 +315,7 @@ sub ShadingProcessing {
. ' - Es ist Nacht oder die Aussentemperatur unterhalb der Shading Temperatur. Die Beschattung wird Zwangsbeendet' . ' - Es ist Nacht oder die Aussentemperatur unterhalb der Shading Temperatur. Die Beschattung wird Zwangsbeendet'
); );
Log3( $name, 4, ::Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing - Der Sonnenstand ist ausserhalb der Winkelangaben oder die Aussentemperatur unterhalb der Shading Temperatur " "AutoShuttersControl ($name) - Shading Processing - Der Sonnenstand ist ausserhalb der Winkelangaben oder die Aussentemperatur unterhalb der Shading Temperatur "
); );
} }
@ -358,7 +342,7 @@ sub ShadingProcessing {
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus $FHEM::Automation::ShuttersControl::shutters->getShadingStatus
eq 'out reserved' eq 'out reserved'
and ( and (
int( gettimeofday() ) - int( ::gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ) ->getShadingStatusTimestamp )
) > $FHEM::Automation::ShuttersControl::shutters ) > $FHEM::Automation::ShuttersControl::shutters
@ -369,7 +353,7 @@ sub ShadingProcessing {
'out'); 'out');
} }
Log3( $name, 4, ::Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " "AutoShuttersControl ($name) - Shading Processing, Rollladen: "
. $shuttersDev . $shuttersDev
. " In der Out Abfrage, Shadingwert: " . " In der Out Abfrage, Shadingwert: "
@ -411,7 +395,7 @@ sub ShadingProcessing {
$FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq $FHEM::Automation::ShuttersControl::shutters->getShadingStatus eq
'in reserved' 'in reserved'
and ( and (
int( gettimeofday() ) - int( ::gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ) > ( ->getShadingStatusTimestamp ) > (
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
@ -423,7 +407,7 @@ sub ShadingProcessing {
'in'); 'in');
} }
Log3( $name, 4, ::Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " "AutoShuttersControl ($name) - Shading Processing, Rollladen: "
. $shuttersDev . $shuttersDev
. " In der In Abfrage, Shadingwert: " . " In der In Abfrage, Shadingwert: "
@ -483,7 +467,7 @@ sub ShadingProcessing {
&& ( && (
( (
( (
int( gettimeofday() ) - int( ::gettimeofday() ) -
$FHEM::Automation::ShuttersControl::shutters $FHEM::Automation::ShuttersControl::shutters
->getShadingStatusTimestamp ->getShadingStatusTimestamp
) < 2 ) < 2
@ -507,8 +491,8 @@ sub ShadingProcessing {
) )
); );
readingsBeginUpdate($shuttersDevHash); ::readingsBeginUpdate($shuttersDevHash);
readingsBulkUpdate( ::readingsBulkUpdate(
$shuttersDevHash, $shuttersDevHash,
'ASC_ShadingMessage', 'ASC_ShadingMessage',
'INFO: current shading status is \'' 'INFO: current shading status is \''
@ -531,7 +515,7 @@ sub ShadingProcessing {
) / 60 ) / 60
. 'm' . 'm'
); );
readingsEndUpdate( $shuttersDevHash, 1 ); ::readingsEndUpdate( $shuttersDevHash, 1 );
return; return;
} }
@ -639,7 +623,7 @@ sub ShadingProcessingDriveCommand {
. ' zum beenden der Beschattung gefahren' ); . ' zum beenden der Beschattung gefahren' );
} }
Log3( $name, 4, ::Log3( $name, 4,
"AutoShuttersControl ($name) - Shading Processing - In der Routine zum fahren der Rollläden, Shading Wert: " "AutoShuttersControl ($name) - Shading Processing - In der Routine zum fahren der Rollläden, Shading Wert: "
. $FHEM::Automation::ShuttersControl::shutters->getShadingStatus ); . $FHEM::Automation::ShuttersControl::shutters->getShadingStatus );