add window event lockOut Routine

This commit is contained in:
Marko Oldenburg
2018-11-21 08:38:32 +01:00
parent 8fa9dbb9de
commit ce711a7435

View File

@ -41,7 +41,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
my $version = "0.2.0.9"; my $version = "0.2.0.10";
sub AutoShuttersControl_Initialize($) { sub AutoShuttersControl_Initialize($) {
my ($hash) = @_; my ($hash) = @_;
@ -521,7 +521,7 @@ sub Set($$@) {
elsif ( lc $cmd eq 'lockout' ) { elsif ( lc $cmd eq 'lockout' ) {
return "usage: $cmd" if ( @args > 1 ); return "usage: $cmd" if ( @args > 1 );
readingsSingleUpdate( $hash, $cmd, join( ' ', @args ), 1 ); readingsSingleUpdate( $hash, $cmd, join( ' ', @args ), 1 );
SetHardewareBlockForShutters( $hash, join( ' ', @args ) ); HardewareBlockForShutters( $hash, join( ' ', @args ) );
} }
elsif ( lc $cmd eq 'sunrisetimeweholiday' ) { elsif ( lc $cmd eq 'sunrisetimeweholiday' ) {
return "usage: $cmd" if ( @args > 1 ); return "usage: $cmd" if ( @args > 1 );
@ -803,6 +803,7 @@ sub EventProcessingWindowRec($@) {
{ # Es wird geschaut ob wärend der Fenster offen Phase ein Fahrbefehl über das Modul kam,wenn ja wird dieser aus geführt { # Es wird geschaut ob wärend der Fenster offen Phase ein Fahrbefehl über das Modul kam,wenn ja wird dieser aus geführt
# if ( $1 eq 'closed' ) { # if ( $1 eq 'closed' ) {
$shutters->setHardLockOut('off');
$shutters->setLastDrive('delayed drive - window closed'); $shutters->setLastDrive('delayed drive - window closed');
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getDelayCmd ); ShuttersCommandSet( $hash, $shuttersDev, $shutters->getDelayCmd );
@ -820,10 +821,12 @@ sub EventProcessingWindowRec($@) {
# ShuttersCommandSet( $hash, $shuttersDev, # ShuttersCommandSet( $hash, $shuttersDev,
# $shutters->getVentilatePos ); # $shutters->getVentilatePos );
# } # }
} }
elsif ( $1 eq 'closed' elsif ( $1 eq 'closed'
) # wenn nicht dann wird entsprechend dem Fensterkontakt Event der Rolladen geschlossen oder zum lüften geöffnet ) # wenn nicht dann wird entsprechend dem Fensterkontakt Event der Rolladen geschlossen oder zum lüften geöffnet
{ {
$shutters->setHardLockOut('off');
if ( $shutters->getStatus == $shutters->getVentilatePos if ( $shutters->getStatus == $shutters->getVentilatePos
or $shutters->getStatus == $shutters->getComfortOpenPos ) or $shutters->getStatus == $shutters->getComfortOpenPos )
{ {
@ -855,6 +858,7 @@ sub EventProcessingWindowRec($@) {
and $queryShuttersPosWinRecTilted and $queryShuttersPosWinRecTilted
) )
{ {
$shutters->setHardLockOut('on');
$shutters->setLastDrive('ventilate - window open'); $shutters->setLastDrive('ventilate - window open');
ShuttersCommandSet( $hash, $shuttersDev, ShuttersCommandSet( $hash, $shuttersDev,
$shutters->getVentilatePos ); $shutters->getVentilatePos );
@ -864,6 +868,7 @@ sub EventProcessingWindowRec($@) {
and $ascDev->getAutoShuttersControlComfort eq 'on' and $ascDev->getAutoShuttersControlComfort eq 'on'
and $queryShuttersPosWinRecComfort ) and $queryShuttersPosWinRecComfort )
{ {
$shutters->setHardLockOut('on');
$shutters->setLastDrive('comfort - window open'); $shutters->setLastDrive('comfort - window open');
ShuttersCommandSet( $hash, $shuttersDev, ShuttersCommandSet( $hash, $shuttersDev,
$shutters->getComfortOpenPos ); $shutters->getComfortOpenPos );
@ -1537,22 +1542,11 @@ sub RenewSunRiseSetShuttersTimer($) {
} }
## Funktion zum hardwareseitigen setzen des lock-out oder blocking beim Rolladen selbst ## Funktion zum hardwareseitigen setzen des lock-out oder blocking beim Rolladen selbst
sub SetHardewareBlockForShutters($$) { sub HardewareBlockForShutters($$) {
my ( $hash, $cmd ) = @_; my ( $hash, $cmd ) = @_;
foreach ( @{ $hash->{helper}{shuttersList} } ) { foreach ( @{ $hash->{helper}{shuttersList} } ) {
$shutters->setShuttersDev($_); $shutters->setShuttersDev($_);
if ( $shutters->getLockOut eq 'hard' $shutters->setHardLockOut($cmd);
and $shutters->getLockOutCmd ne 'none' )
{
CommandSet( undef, $_ . ' inhibit ' . $cmd )
if ( $shutters->getLockOutCmd eq 'inhibit' );
CommandSet( undef,
$_ . ' ' . ( $cmd eq 'on' ? 'blocked' : 'unblocked' ) )
if ( $shutters->getLockOutCmd eq 'blocked' );
CommandSet( undef,
$_ . ' ' . ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) )
if ( $shutters->getLockOutCmd eq 'protection' );
}
} }
} }
@ -2306,7 +2300,8 @@ BEGIN {
ReadingsVal ReadingsVal
readingsSingleUpdate readingsSingleUpdate
gettimeofday gettimeofday
InternalTimer) InternalTimer
CommandSet)
); );
} }
@ -2335,6 +2330,24 @@ sub getShuttersDev {
return $self->{shuttersDev}; return $self->{shuttersDev};
} }
sub setHardLockOut {
my ( $self, $cmd ) = @_;
if ( $shutters->getLockOut eq 'hard'
and $shutters->getLockOutCmd ne 'none' )
{
CommandSet( undef, $_ . ' inhibit ' . $cmd )
if ( $shutters->getLockOutCmd eq 'inhibit' );
CommandSet( undef,
$_ . ' ' . ( $cmd eq 'on' ? 'blocked' : 'unblocked' ) )
if ( $shutters->getLockOutCmd eq 'blocked' );
CommandSet( undef,
$_ . ' ' . ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) )
if ( $shutters->getLockOutCmd eq 'protection' );
}
return 0;
}
sub setNoOffset { sub setNoOffset {
my ( $self, $noOffset ) = @_; my ( $self, $noOffset ) = @_;