mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-03 01:25:12 +00:00
73_AutoShuttersControl: add abort rain unprotection waiting time
git-svn-id: https://svn.fhem.de/fhem/trunk@24470 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b2cd54325f
commit
73989fdb8c
@ -1265,7 +1265,7 @@ sub Initialize {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v0.10.13",
|
"version": "v0.10.14",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
||||||
],
|
],
|
||||||
|
@ -282,7 +282,7 @@ sub _getRainSensor {
|
|||||||
? $pos
|
? $pos
|
||||||
: $FHEM::Automation::ShuttersControl::shutters->getClosedPos );
|
: $FHEM::Automation::ShuttersControl::shutters->getClosedPos );
|
||||||
$self->{ASC_rainSensor}->{waitingTime} =
|
$self->{ASC_rainSensor}->{waitingTime} =
|
||||||
( $pos ne 'none' ? $wait : 900 );
|
( $wait ne 'none' ? $wait : 0 );
|
||||||
|
|
||||||
return $self->{ASC_rainSensor}->{device};
|
return $self->{ASC_rainSensor}->{device};
|
||||||
}
|
}
|
||||||
|
@ -79,24 +79,33 @@ sub RainProcessing {
|
|||||||
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus !=
|
||||||
$rainClosedPos
|
$rainClosedPos
|
||||||
&& $FHEM::Automation::ShuttersControl::shutters
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
->getRainProtectionStatus eq 'unprotected' )
|
->getRainProtectionStatus eq 'unprotected'
|
||||||
|
|| ( $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getRainProtectionStatus eq 'unprotected'
|
||||||
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getRainUnprotectionDelayObj ne 'none')
|
||||||
|
)
|
||||||
{
|
{
|
||||||
_RainProtected();
|
_RainProtected();
|
||||||
}
|
}
|
||||||
elsif ( ( $val == 0 || $val < $triggerMin )
|
elsif ( ( $val == 0 || $val < $triggerMin )
|
||||||
&& $FHEM::Automation::ShuttersControl::shutters->getStatus ==
|
&& $FHEM::Automation::ShuttersControl::shutters->getStatus ==
|
||||||
$rainClosedPos
|
$rainClosedPos
|
||||||
&& IsAfterShuttersManualBlocking($shuttersDev)
|
&& IsAfterShuttersManualBlocking($shuttersDev)
|
||||||
&& $FHEM::Automation::ShuttersControl::shutters
|
&& $FHEM::Automation::ShuttersControl::shutters
|
||||||
->getRainProtectionStatus eq 'protected' )
|
->getRainProtectionStatus eq 'protected' )
|
||||||
{
|
{
|
||||||
my %funcHash = (
|
my %funcHash = (
|
||||||
shuttersdevice => $shuttersDev,
|
shuttersdevice => $shuttersDev,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj(\%funcHash);
|
||||||
::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime
|
::InternalTimer( ::gettimeofday() + $FHEM::Automation::ShuttersControl::ascDev->getRainWaitingTime
|
||||||
, \&_RainUnprotected
|
, \&_RainUnprotected
|
||||||
, \%funcHash );
|
, \%funcHash );
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->setRainProtectionStatus('unprotected');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +114,11 @@ sub RainProcessing {
|
|||||||
|
|
||||||
### es muss noch beobachtet werden ob die Auswahl des Rollos welches bearbeitet werden soll bestehen bleibt oder mit in die neuen Funktionen übergeben werden muss
|
### es muss noch beobachtet werden ob die Auswahl des Rollos welches bearbeitet werden soll bestehen bleibt oder mit in die neuen Funktionen übergeben werden muss
|
||||||
sub _RainProtected {
|
sub _RainProtected {
|
||||||
|
::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj)
|
||||||
|
if($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none');
|
||||||
|
|
||||||
|
$FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none');
|
||||||
|
|
||||||
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
||||||
'rain protected');
|
'rain protected');
|
||||||
$FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
|
$FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
|
||||||
@ -123,20 +137,26 @@ sub _RainUnprotected {
|
|||||||
|
|
||||||
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
$FHEM::Automation::ShuttersControl::shutters->setLastDrive(
|
||||||
'rain un-protected');
|
'rain un-protected');
|
||||||
$FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
|
|
||||||
(
|
if ( $FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj ne 'none' ) {
|
||||||
$FHEM::Automation::ShuttersControl::shutters->getIsDay
|
::RemoveInternalTimer($FHEM::Automation::ShuttersControl::shutters->getRainUnprotectionDelayObj);
|
||||||
? $FHEM::Automation::ShuttersControl::shutters->getLastPos
|
$FHEM::Automation::ShuttersControl::shutters->setRainUnprotectionDelayObj('none');
|
||||||
: (
|
}
|
||||||
$FHEM::Automation::ShuttersControl::shutters
|
|
||||||
->getPrivacyDownStatus == 2
|
$FHEM::Automation::ShuttersControl::shutters->setDriveCmd(
|
||||||
? $FHEM::Automation::ShuttersControl::shutters
|
(
|
||||||
->getPrivacyDownPos
|
$FHEM::Automation::ShuttersControl::shutters->getIsDay
|
||||||
: $FHEM::Automation::ShuttersControl::shutters
|
? $FHEM::Automation::ShuttersControl::shutters->getLastPos
|
||||||
->getClosedPos
|
: (
|
||||||
)
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getPrivacyDownStatus == 2
|
||||||
|
? $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getPrivacyDownPos
|
||||||
|
: $FHEM::Automation::ShuttersControl::shutters
|
||||||
|
->getClosedPos
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$FHEM::Automation::ShuttersControl::shutters
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
->setRainProtectionStatus('unprotected');
|
->setRainProtectionStatus('unprotected');
|
||||||
|
@ -57,22 +57,6 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use utf8;
|
use utf8;
|
||||||
|
|
||||||
use GPUtils qw(GP_Import);
|
|
||||||
|
|
||||||
## Import der FHEM Funktionen
|
|
||||||
BEGIN {
|
|
||||||
GP_Import(
|
|
||||||
qw(
|
|
||||||
defs
|
|
||||||
ReadingsVal
|
|
||||||
readingsSingleUpdate
|
|
||||||
gettimeofday
|
|
||||||
InternalTimer
|
|
||||||
CommandSet
|
|
||||||
Log3)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $self = {
|
my $self = {
|
||||||
@ -114,15 +98,15 @@ sub setHardLockOut {
|
|||||||
&& $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd ne
|
&& $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd ne
|
||||||
'none' )
|
'none' )
|
||||||
{
|
{
|
||||||
CommandSet( undef, $self->{shuttersDev} . ' inhibit ' . $cmd )
|
::CommandSet( undef, $self->{shuttersDev} . ' inhibit ' . $cmd )
|
||||||
if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq
|
if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq
|
||||||
'inhibit' );
|
'inhibit' );
|
||||||
CommandSet( undef,
|
::CommandSet( undef,
|
||||||
$self->{shuttersDev} . ' '
|
$self->{shuttersDev} . ' '
|
||||||
. ( $cmd eq 'on' ? 'blocked' : 'unblocked' ) )
|
. ( $cmd eq 'on' ? 'blocked' : 'unblocked' ) )
|
||||||
if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq
|
if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq
|
||||||
'blocked' );
|
'blocked' );
|
||||||
CommandSet( undef,
|
::CommandSet( undef,
|
||||||
$self->{shuttersDev} . ' '
|
$self->{shuttersDev} . ' '
|
||||||
. ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) )
|
. ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) )
|
||||||
if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq
|
if ( $FHEM::Automation::ShuttersControl::shutters->getLockOutCmd eq
|
||||||
@ -245,8 +229,8 @@ sub setDriveCmd {
|
|||||||
&& $FHEM::Automation::ShuttersControl::ascDev->getSelfDefense eq
|
&& $FHEM::Automation::ShuttersControl::ascDev->getSelfDefense eq
|
||||||
'on' )
|
'on' )
|
||||||
{
|
{
|
||||||
InternalTimer(
|
::InternalTimer(
|
||||||
gettimeofday() +
|
::gettimeofday() +
|
||||||
$FHEM::Automation::ShuttersControl::shutters
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
->getSelfDefenseAbsentDelay,
|
->getSelfDefenseAbsentDelay,
|
||||||
\&FHEM::Automation::ShuttersControl::_SetCmdFn, \%h
|
\&FHEM::Automation::ShuttersControl::_SetCmdFn, \%h
|
||||||
@ -257,8 +241,8 @@ sub setDriveCmd {
|
|||||||
elsif ( $offSetStart > 0
|
elsif ( $offSetStart > 0
|
||||||
&& !$FHEM::Automation::ShuttersControl::shutters->getNoDelay )
|
&& !$FHEM::Automation::ShuttersControl::shutters->getNoDelay )
|
||||||
{
|
{
|
||||||
InternalTimer(
|
::InternalTimer(
|
||||||
gettimeofday() + int(
|
::gettimeofday() + int(
|
||||||
rand($offSet) +
|
rand($offSet) +
|
||||||
$FHEM::Automation::ShuttersControl::shutters
|
$FHEM::Automation::ShuttersControl::shutters
|
||||||
->getDelayStart
|
->getDelayStart
|
||||||
@ -354,14 +338,14 @@ sub setPosSetCmd {
|
|||||||
|
|
||||||
sub setLastDriveReading {
|
sub setLastDriveReading {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $shuttersDevHash = $defs{ $self->{shuttersDev} };
|
my $shuttersDevHash = $::defs{ $self->{shuttersDev} };
|
||||||
|
|
||||||
my %h = (
|
my %h = (
|
||||||
devHash => $shuttersDevHash,
|
devHash => $shuttersDevHash,
|
||||||
lastDrive => $FHEM::Automation::ShuttersControl::shutters->getLastDrive,
|
lastDrive => $FHEM::Automation::ShuttersControl::shutters->getLastDrive,
|
||||||
);
|
);
|
||||||
|
|
||||||
InternalTimer( gettimeofday() + 0.1,
|
::InternalTimer( ::gettimeofday() + 0.1,
|
||||||
\&FHEM::Automation::ShuttersControl::_setShuttersLastDriveDelayed,
|
\&FHEM::Automation::ShuttersControl::_setShuttersLastDriveDelayed,
|
||||||
\%h );
|
\%h );
|
||||||
return;
|
return;
|
||||||
@ -375,7 +359,7 @@ sub setLastPos {
|
|||||||
|
|
||||||
$self->{ $self->{shuttersDev} }{lastPos}{VAL} = $position
|
$self->{ $self->{shuttersDev} }{lastPos}{VAL} = $position
|
||||||
if ( defined($position) );
|
if ( defined($position) );
|
||||||
$self->{ $self->{shuttersDev} }{lastPos}{TIME} = int( gettimeofday() )
|
$self->{ $self->{shuttersDev} }{lastPos}{TIME} = int( ::gettimeofday() )
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{lastPos} ) );
|
if ( defined( $self->{ $self->{shuttersDev} }{lastPos} ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -386,11 +370,11 @@ sub setLastManPos {
|
|||||||
|
|
||||||
$self->{ $self->{shuttersDev} }{lastManPos}{VAL} = $position
|
$self->{ $self->{shuttersDev} }{lastManPos}{VAL} = $position
|
||||||
if ( defined($position) );
|
if ( defined($position) );
|
||||||
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( gettimeofday() )
|
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( ::gettimeofday() )
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
||||||
&& defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
&& defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
||||||
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} =
|
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} =
|
||||||
int( gettimeofday() ) - 86400
|
int( ::gettimeofday() ) - 86400
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
||||||
&& !defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
&& !defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
||||||
return;
|
return;
|
||||||
@ -472,6 +456,15 @@ sub setRainProtectionStatus { # Werte protected, unprotected
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub setRainUnprotectionDelayObj {
|
||||||
|
my $self = shift;
|
||||||
|
my $value = shift;
|
||||||
|
|
||||||
|
$self->{ $self->{shuttersDev} }->{RainProtection}->{UNPROTECTIONDELAYOBJVAL} = $value
|
||||||
|
if ( defined($value) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sub setExternalTriggerStatus {
|
sub setExternalTriggerStatus {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = shift;
|
my $value = shift;
|
||||||
@ -666,7 +659,7 @@ sub getLastDrive {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
$self->{ $self->{shuttersDev} }{lastDrive} =
|
$self->{ $self->{shuttersDev} }{lastDrive} =
|
||||||
ReadingsVal( $self->{shuttersDev}, 'ASC_ShuttersLastDrive', 'none' )
|
::ReadingsVal( $self->{shuttersDev}, 'ASC_ShuttersLastDrive', 'none' )
|
||||||
if ( !defined( $self->{ $self->{shuttersDev} }{lastDrive} ) );
|
if ( !defined( $self->{ $self->{shuttersDev} }{lastDrive} ) );
|
||||||
|
|
||||||
return $self->{ $self->{shuttersDev} }{lastDrive};
|
return $self->{ $self->{shuttersDev} }{lastDrive};
|
||||||
@ -756,6 +749,21 @@ sub getRainProtectionStatus { # Werte protected, unprotected
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub getRainUnprotectionDelayObj {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
return (
|
||||||
|
(
|
||||||
|
defined( $self->{ $self->{shuttersDev} }->{RainProtection} )
|
||||||
|
&& defined(
|
||||||
|
$self->{ $self->{shuttersDev} }->{RainProtection}->{UNPROTECTIONDELAYOBJVAL}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
? $self->{ $self->{shuttersDev} }->{RainProtection}->{UNPROTECTIONDELAYOBJVAL}
|
||||||
|
: 'none'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
sub getSunsetUnixTime {
|
sub getSunsetUnixTime {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
@ -857,7 +865,7 @@ sub getRoommatesLastStatus {
|
|||||||
sub getOutTemp {
|
sub getOutTemp {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return ReadingsVal(
|
return ::ReadingsVal(
|
||||||
$FHEM::Automation::ShuttersControl::shutters->_getTempSensor,
|
$FHEM::Automation::ShuttersControl::shutters->_getTempSensor,
|
||||||
$FHEM::Automation::ShuttersControl::shutters->getTempSensorReading,
|
$FHEM::Automation::ShuttersControl::shutters->getTempSensorReading,
|
||||||
-100 );
|
-100 );
|
||||||
@ -866,7 +874,7 @@ sub getOutTemp {
|
|||||||
sub getIdleDetection {
|
sub getIdleDetection {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return ReadingsVal(
|
return ::ReadingsVal(
|
||||||
$self->{shuttersDev},
|
$self->{shuttersDev},
|
||||||
$FHEM::Automation::ShuttersControl::shutters->_getIdleDetectionReading,
|
$FHEM::Automation::ShuttersControl::shutters->_getIdleDetectionReading,
|
||||||
'none'
|
'none'
|
||||||
@ -891,7 +899,7 @@ sub setShadingStatus {
|
|||||||
|
|
||||||
$self->{ $self->{shuttersDev} }{ShadingStatus}{VAL} = $value
|
$self->{ $self->{shuttersDev} }{ShadingStatus}{VAL} = $value
|
||||||
if ( defined($value) );
|
if ( defined($value) );
|
||||||
$self->{ $self->{shuttersDev} }{ShadingStatus}{TIME} = int( gettimeofday() )
|
$self->{ $self->{shuttersDev} }{ShadingStatus}{TIME} = int( ::gettimeofday() )
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{ShadingStatus} ) );
|
if ( defined( $self->{ $self->{shuttersDev} }{ShadingStatus} ) );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -909,7 +917,7 @@ sub setShadingLastStatus {
|
|||||||
$self->{ $self->{shuttersDev} }{ShadingLastStatus}{VAL} = $value
|
$self->{ $self->{shuttersDev} }{ShadingLastStatus}{VAL} = $value
|
||||||
if ( defined($value) );
|
if ( defined($value) );
|
||||||
$self->{ $self->{shuttersDev} }{ShadingLastStatus}{TIME} =
|
$self->{ $self->{shuttersDev} }{ShadingLastStatus}{TIME} =
|
||||||
int( gettimeofday() )
|
int( ::gettimeofday() )
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{ShadingLastStatus} ) );
|
if ( defined( $self->{ $self->{shuttersDev} }{ShadingLastStatus} ) );
|
||||||
$self->{ $self->{shuttersDev} }{ShadingManualDriveStatus}{VAL} = 0
|
$self->{ $self->{shuttersDev} }{ShadingManualDriveStatus}{VAL} = 0
|
||||||
if ( $value eq 'out' );
|
if ( $value eq 'out' );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user