add set global shading off logic

This commit is contained in:
2020-10-05 10:37:50 +02:00
parent a2d88bddf2
commit 09fd5cd36b
3 changed files with 67 additions and 50 deletions

View File

@ -1,15 +1,15 @@
UPD 2020-10-05_09:59:54 97597 FHEM/73_AutoShuttersControl.pm UPD 2020-10-05_10:02:00 97597 FHEM/73_AutoShuttersControl.pm
UPD 2020-10-05_09:59:50 74112 lib/FHEM/Automation/ShuttersControl.pm UPD 2020-10-05_10:37:05 74123 lib/FHEM/Automation/ShuttersControl.pm
UPD 2020-06-22_09:41:40 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm UPD 2020-06-22_09:41:40 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm
UPD 2020-07-26_17:36:29 2496 lib/FHEM/Automation/ShuttersControl/Roommate.pm UPD 2020-07-26_17:36:29 2496 lib/FHEM/Automation/ShuttersControl/Roommate.pm
UPD 2020-08-12_11:00:05 31376 lib/FHEM/Automation/ShuttersControl/Shutters.pm UPD 2020-08-12_11:00:05 31376 lib/FHEM/Automation/ShuttersControl/Shutters.pm
UPD 2020-09-07_09:25:45 24589 lib/FHEM/Automation/ShuttersControl/Shading.pm UPD 2020-10-05_10:36:38 25275 lib/FHEM/Automation/ShuttersControl/Shading.pm
UPD 2020-10-05_09:59:52 109379 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm UPD 2020-10-05_10:02:00 109379 lib/FHEM/Automation/ShuttersControl/EventProcessingFunctions.pm
UPD 2020-08-18_08:40:35 45518 lib/FHEM/Automation/ShuttersControl/Helper.pm UPD 2020-08-18_08:40:35 45518 lib/FHEM/Automation/ShuttersControl/Helper.pm
UPD 2020-06-22_09:41:40 2175 lib/FHEM/Automation/ShuttersControl/Window.pm UPD 2020-06-22_09:41:40 2175 lib/FHEM/Automation/ShuttersControl/Window.pm
UPD 2020-07-26_17:36:29 11569 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm UPD 2020-07-26_17:36:29 11569 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
UPD 2020-07-03_11:29:10 7251 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm UPD 2020-07-03_11:29:10 7251 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm
UPD 2020-10-05_09:56:35 52429 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm UPD 2020-10-05_10:02:00 52429 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm
UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm UPD 2020-06-22_09:41:40 2903 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm
UPD 2020-06-22_09:41:40 3972 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm UPD 2020-06-22_09:41:40 3972 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm
UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm UPD 2020-06-22_09:41:40 2288 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm

View File

@ -571,7 +571,7 @@ sub Set {
elsif ( lc $cmd eq 'controlshading' ) { elsif ( lc $cmd eq 'controlshading' ) {
return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 ); return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 );
my $response = CheckASC_ConditionsForShadingFn($hash); my $response = CheckASC_ConditionsForShadingFn($hash,$aArg->[0]);
readingsSingleUpdate( readingsSingleUpdate(
$hash, $cmd, $hash, $cmd,
( (

View File

@ -84,6 +84,7 @@ BEGIN {
sub CheckASC_ConditionsForShadingFn { sub CheckASC_ConditionsForShadingFn {
my $hash = shift; my $hash = shift;
my $value = shift;
my $error; my $error;
@ -96,10 +97,16 @@ sub CheckASC_ConditionsForShadingFn {
my $count = 1; my $count = 1;
for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) { for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
my %funcHash = (
hash => $hash,
shuttersdevice => $shuttersDev,
value => $value,
);
InternalTimer( InternalTimer(
gettimeofday() + $count, gettimeofday() + $count,
'FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn', 'FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn',
$shuttersDev \%funcHash
); );
$count++; $count++;
@ -113,7 +120,11 @@ sub CheckASC_ConditionsForShadingFn {
} }
sub _CheckShuttersConditionsForShadingFn { sub _CheckShuttersConditionsForShadingFn {
my $shuttersDev = shift; my $funcHash = shift;
my $hash = $funcHash->{hash};
my $shuttersDev = $funcHash->{shuttersdevice};
my $value = $funcHash->{value};
$FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev); $FHEM::Automation::ShuttersControl::shutters->setShuttersDev($shuttersDev);
my $shuttersDevHash = $defs{$shuttersDev}; my $shuttersDevHash = $defs{$shuttersDev};
@ -122,6 +133,11 @@ sub _CheckShuttersConditionsForShadingFn {
my $warnMessage; my $warnMessage;
my $infoMessage; my $infoMessage;
if ( $value eq 'off' ) {
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out');
$infoMessage .= ' shading was deactivated globally';
ShadingProcessingDriveCommand( $hash, $shuttersDev );
} else {
$infoMessage .= ( $infoMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off' $FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
&& $FHEM::Automation::ShuttersControl::ascDev && $FHEM::Automation::ShuttersControl::ascDev
@ -162,6 +178,7 @@ sub _CheckShuttersConditionsForShadingFn {
? ' no brightness sensor found, please set ASC_BrightnessSensor attribut' ? ' no brightness sensor found, please set ASC_BrightnessSensor attribut'
: '' : ''
); );
}
$message .= ' ERROR: ' . $errorMessage $message .= ' ERROR: ' . $errorMessage
if ( defined($errorMessage) if ( defined($errorMessage)