add set global shading off logic

This commit is contained in:
Marko Oldenburg 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_09:59:50 74112 lib/FHEM/Automation/ShuttersControl.pm
UPD 2020-10-05_10:02:00 97597 FHEM/73_AutoShuttersControl.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-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-09-07_09:25:45 24589 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:36:38 25275 lib/FHEM/Automation/ShuttersControl/Shading.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-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-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 3972 lib/FHEM/Automation/ShuttersControl/Window/Attr.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' ) {
return "usage: $cmd" if ( scalar( @{$aArg} ) > 1 );
my $response = CheckASC_ConditionsForShadingFn($hash);
my $response = CheckASC_ConditionsForShadingFn($hash,$aArg->[0]);
readingsSingleUpdate(
$hash, $cmd,
(

View File

@ -83,7 +83,8 @@ BEGIN {
}
sub CheckASC_ConditionsForShadingFn {
my $hash = shift;
my $hash = shift;
my $value = shift;
my $error;
@ -96,10 +97,16 @@ sub CheckASC_ConditionsForShadingFn {
my $count = 1;
for my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
my %funcHash = (
hash => $hash,
shuttersdevice => $shuttersDev,
value => $value,
);
InternalTimer(
gettimeofday() + $count,
'FHEM::Automation::ShuttersControl::Shading::_CheckShuttersConditionsForShadingFn',
$shuttersDev
\%funcHash
);
$count++;
@ -113,7 +120,11 @@ sub CheckASC_ConditionsForShadingFn {
}
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);
my $shuttersDevHash = $defs{$shuttersDev};
@ -121,59 +132,65 @@ sub _CheckShuttersConditionsForShadingFn {
my $errorMessage;
my $warnMessage;
my $infoMessage;
if ( $value eq 'off' ) {
$FHEM::Automation::ShuttersControl::shutters->setShadingStatus('out');
$infoMessage .= ' shading was deactivated globally';
ShadingProcessingDriveCommand( $hash, $shuttersDev );
} else {
$infoMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
&& $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'
: ''
);
$infoMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode ne 'off'
&& $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'
: ''
);
$warnMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
&& $FHEM::Automation::ShuttersControl::ascDev
->getAutoShuttersControlShading eq 'on'
? ' global shading active but ASC_Shading_Mode attribut is not set or off'
: ''
);
$warnMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode eq 'off'
&& $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'
? ' ASC_Shading_Mode attribut is set but global shading has errors, look at ASC device '
. '<a href="'
. '/fhem?detail='
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
. $::FW_CSRF . '">'
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
. '</a>'
: ''
);
$errorMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getShadingMode 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='
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
. $::FW_CSRF . '">'
. ReadingsVal( $shuttersDev, 'associatedWith', 'ASC device' )
. '</a>'
: ''
);
$errorMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getBrightness == -1
&& $FHEM::Automation::ShuttersControl::shutters->getShadingMode ne
'off'
? ' no brightness sensor found, please set ASC_BrightnessSensor attribut'
: ''
);
$errorMessage .= (
$FHEM::Automation::ShuttersControl::shutters->getBrightness == -1
&& $FHEM::Automation::ShuttersControl::shutters->getShadingMode ne
'off'
? ' no brightness sensor found, please set ASC_BrightnessSensor attribut'
: ''
);
}
$message .= ' ERROR: ' . $errorMessage
if ( defined($errorMessage)
if ( defined($errorMessage)
&& $errorMessage ne '' );
$message .= ' WARN: ' . $warnMessage
if ( defined($warnMessage)
if ( defined($warnMessage)
&& $warnMessage ne ''
&& $errorMessage eq '' );
$message .= ' INFO: ' . $infoMessage
if ( defined($infoMessage)
if ( defined($infoMessage)
&& $infoMessage ne ''
&& $errorMessage eq '' );