2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

73_AutoShuttersControl: change hardLockOut mode code

git-svn-id: https://svn.fhem.de/fhem/trunk@17808 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2018-11-21 21:11:07 +00:00
parent 8c4a17af9a
commit c672ed3b87
2 changed files with 34 additions and 19 deletions

View File

@ -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

View File

@ -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 ) = @_;