diff --git a/fhem/CHANGED b/fhem/CHANGED index 4432dbe72..0ec8059f3 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 73_AutoShuttersControl: change hardLockOut mode code - bugfix: 73_AutoShuttersControl: bug line 623 - feature: 73_AutoShuttersControl: add lockOut support at Z-Wave - feature: 73_AutoShuttersControl: ASC Attribut support for value zero diff --git a/fhem/FHEM/73_AutoShuttersControl.pm b/fhem/FHEM/73_AutoShuttersControl.pm index 327d0b289..9e1460496 100644 --- a/fhem/FHEM/73_AutoShuttersControl.pm +++ b/fhem/FHEM/73_AutoShuttersControl.pm @@ -41,7 +41,7 @@ package main; use strict; use warnings; -my $version = "0.2.0.9"; +my $version = "0.2.0.10"; sub AutoShuttersControl_Initialize($) { my ($hash) = @_; @@ -518,10 +518,10 @@ sub Set($$@) { return "usage: $cmd" if ( @args > 1 ); readingsSingleUpdate( $hash, $cmd, join( ' ', @args ), 1 ); } - elsif ( lc $cmd eq 'lockout' ) { + elsif ( lc $cmd eq 'hardlockout' ) { return "usage: $cmd" if ( @args > 1 ); readingsSingleUpdate( $hash, $cmd, join( ' ', @args ), 1 ); - SetHardewareBlockForShutters( $hash, join( ' ', @args ) ); + HardewareBlockForShutters( $hash, join( ' ', @args ) ); } elsif ( lc $cmd eq 'sunrisetimeweholiday' ) { return "usage: $cmd" if ( @args > 1 ); @@ -539,7 +539,7 @@ sub Set($$@) { else { my $list = "scanForShutters:noArg"; $list .= -" renewSetSunriseSunsetTimer:noArg partyMode:on,off lockOut:on,off sunriseTimeWeHoliday:on,off selfDefense:on,off wiggle:all," +" renewSetSunriseSunsetTimer:noArg partyMode:on,off hardLockOut:on,off sunriseTimeWeHoliday:on,off selfDefense:on,off wiggle:all," . join( ',', @{ $hash->{helper}{shuttersList} } ) if ( ReadingsVal( $name, 'userAttrList', 'none' ) eq 'rolled out' ); $list .= " createNewNotifyDev:noArg" @@ -786,6 +786,11 @@ sub EventProcessingWindowRec($@) { if ( $events =~ m#state:\s(open|closed|tilted)# ) { $shutters->setShuttersDev($shuttersDev); + + #### Hardware Lock der Rollläden + $shutters->setHardLockOut('off') unless ( $1 eq 'open' or $1 eq 'tilted' ); + $shutters->setHardLockOut('on') unless ( $1 eq 'closed' ); + $shutters->setNoOffset(1); my $queryShuttersPosWinRecTilted = ( @@ -805,7 +810,7 @@ sub EventProcessingWindowRec($@) { # if ( $1 eq 'closed' ) { $shutters->setLastDrive('delayed drive - window closed'); ShuttersCommandSet( $hash, $shuttersDev, $shutters->getDelayCmd ); - + # } # elsif ( # ( @@ -820,6 +825,7 @@ sub EventProcessingWindowRec($@) { # ShuttersCommandSet( $hash, $shuttersDev, # $shutters->getVentilatePos ); # } + } elsif ( $1 eq 'closed' ) # wenn nicht dann wird entsprechend dem Fensterkontakt Event der Rolladen geschlossen oder zum lüften geöffnet @@ -1537,22 +1543,11 @@ sub RenewSunRiseSetShuttersTimer($) { } ## Funktion zum hardwareseitigen setzen des lock-out oder blocking beim Rolladen selbst -sub SetHardewareBlockForShutters($$) { +sub HardewareBlockForShutters($$) { my ( $hash, $cmd ) = @_; foreach ( @{ $hash->{helper}{shuttersList} } ) { $shutters->setShuttersDev($_); - 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' ); - } + $shutters->setHardLockOut($cmd); } } @@ -2306,7 +2301,8 @@ BEGIN { ReadingsVal readingsSingleUpdate gettimeofday - InternalTimer) + InternalTimer + CommandSet) ); } @@ -2335,6 +2331,24 @@ sub getShuttersDev { return $self->{shuttersDev}; } +sub setHardLockOut { + my ( $self, $cmd ) = @_; + + if ( $shutters->getLockOut eq 'hard' + and $shutters->getLockOutCmd ne 'none' ) + { + CommandSet( undef, $self->{shuttersDev} . ' inhibit ' . $cmd ) + if ( $shutters->getLockOutCmd eq 'inhibit' ); + CommandSet( undef, + $self->{shuttersDev} . ' ' . ( $cmd eq 'on' ? 'blocked' : 'unblocked' ) ) + if ( $shutters->getLockOutCmd eq 'blocked' ); + CommandSet( undef, + $self->{shuttersDev} . ' ' . ( $cmd eq 'on' ? 'protectionOn' : 'protectionOff' ) ) + if ( $shutters->getLockOutCmd eq 'protection' ); + } + return 0; +} + sub setNoOffset { my ( $self, $noOffset ) = @_;