merge patch from Christoph, expand Events RegEx for Window Events
This commit is contained in:
parent
35f0f01bbc
commit
3de6fe1c08
@ -12,6 +12,7 @@
|
|||||||
# - FunkOdyssey commandref style
|
# - FunkOdyssey commandref style
|
||||||
# - sledge fix many typo in commandref
|
# - sledge fix many typo in commandref
|
||||||
# - many User that use with modul and report bugs
|
# - many User that use with modul and report bugs
|
||||||
|
# - Christoph (christoph.kaiser.in) Patch that expand RegEx for Window Events
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# This script is free software; you can redistribute it and/or modify
|
# This script is free software; you can redistribute it and/or modify
|
||||||
@ -45,7 +46,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use FHEM::Meta;
|
use FHEM::Meta;
|
||||||
|
|
||||||
my $version = '0.6.13';
|
my $version = '0.6.14';
|
||||||
|
|
||||||
sub AutoShuttersControl_Initialize($) {
|
sub AutoShuttersControl_Initialize($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -839,6 +840,7 @@ sub AddNotifyDev($@) {
|
|||||||
%hash = map { ( $_ => 1 ) }
|
%hash = map { ( $_ => 1 ) }
|
||||||
split( ',', "$notifyDev,$dev" );
|
split( ',', "$notifyDev,$dev" );
|
||||||
|
|
||||||
|
my $match; # CK: added local variable to save matched event type (open|opened|close|closed|tilt|tilted)
|
||||||
$hash->{NOTIFYDEV} = join( ',', sort keys %hash );
|
$hash->{NOTIFYDEV} = join( ',', sort keys %hash );
|
||||||
|
|
||||||
my @devs = split( ',', $dev );
|
my @devs = split( ',', $dev );
|
||||||
@ -886,20 +888,30 @@ sub EventProcessingWindowRec($@) {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$events =~
|
$events =~ m#.*state:.*(open(?>ed)?|closed?|tilt(?>ed)?)#
|
||||||
m#state:\s(open(ed)?|closed|tilted)# # weitere mögliche Events (opened / closed)
|
and IsAfterShuttersManualBlocking($shuttersDev)
|
||||||
and IsAfterShuttersManualBlocking($shuttersDev)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
$match = $1;
|
||||||
|
|
||||||
|
ASC_Debug( 'EventProcessingWindowRec: '
|
||||||
|
. $shutters->getShuttersDev
|
||||||
|
.' - RECEIVED EVENT: '
|
||||||
|
. $events
|
||||||
|
.' - IDENTIFIED EVENT: '
|
||||||
|
. $1
|
||||||
|
.' - STORED EVENT: '
|
||||||
|
. $match );
|
||||||
|
|
||||||
$shutters->setShuttersDev($shuttersDev);
|
$shutters->setShuttersDev($shuttersDev);
|
||||||
my $homemode = $shutters->getRoommatesStatus;
|
my $homemode = $shutters->getRoommatesStatus;
|
||||||
$homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' );
|
$homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' );
|
||||||
|
|
||||||
#### Hardware Lock der Rollläden
|
#### Hardware Lock der Rollläden
|
||||||
$shutters->setHardLockOut('off')
|
$shutters->setHardLockOut('off')
|
||||||
if ( $1 eq 'closed' and $shutters->getShuttersPlace eq 'terrace' );
|
if ( $match =~ /close/ and $shutters->getShuttersPlace eq 'terrace' );
|
||||||
$shutters->setHardLockOut('on')
|
$shutters->setHardLockOut('on')
|
||||||
if ( ( $1 eq 'open' or $1 eq 'opened' )
|
if ( $match =~ /open/
|
||||||
and $shutters->getShuttersPlace eq 'terrace' );
|
and $shutters->getShuttersPlace eq 'terrace' );
|
||||||
|
|
||||||
my $queryShuttersPosWinRecTilted = (
|
my $queryShuttersPosWinRecTilted = (
|
||||||
@ -922,8 +934,8 @@ sub EventProcessingWindowRec($@) {
|
|||||||
. ' QueryShuttersPosWinRecComfort: '
|
. ' QueryShuttersPosWinRecComfort: '
|
||||||
. $queryShuttersPosWinRecComfort );
|
. $queryShuttersPosWinRecComfort );
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$1 eq 'closed'
|
$match =~ /close/
|
||||||
and IsAfterShuttersTimeBlocking($shuttersDev)
|
and IsAfterShuttersTimeBlocking($shuttersDev)
|
||||||
and ( $shutters->getStatus == $shutters->getVentilatePos
|
and ( $shutters->getStatus == $shutters->getVentilatePos
|
||||||
or $shutters->getStatus == $shutters->getComfortOpenPos
|
or $shutters->getStatus == $shutters->getComfortOpenPos
|
||||||
@ -974,9 +986,9 @@ sub EventProcessingWindowRec($@) {
|
|||||||
}
|
}
|
||||||
elsif (
|
elsif (
|
||||||
(
|
(
|
||||||
$1 eq 'tilted'
|
$match =~ /tilt/
|
||||||
or ( ( $1 eq 'open' or $1 eq 'opened' )
|
or ( $match =~ /open/
|
||||||
and $shutters->getSubTyp eq 'twostate' )
|
and $shutters->getSubTyp eq 'twostate' )
|
||||||
)
|
)
|
||||||
and $shutters->getVentilateOpen eq 'on'
|
and $shutters->getVentilateOpen eq 'on'
|
||||||
and $queryShuttersPosWinRecTilted
|
and $queryShuttersPosWinRecTilted
|
||||||
@ -986,7 +998,7 @@ sub EventProcessingWindowRec($@) {
|
|||||||
$shutters->setNoOffset(1);
|
$shutters->setNoOffset(1);
|
||||||
$shutters->setDriveCmd( $shutters->getVentilatePos );
|
$shutters->setDriveCmd( $shutters->getVentilatePos );
|
||||||
}
|
}
|
||||||
elsif ( ( $1 eq 'open' or $1 eq 'opened' )
|
elsif ( $match =~ /open/
|
||||||
and $shutters->getSubTyp eq 'threestate' )
|
and $shutters->getSubTyp eq 'threestate' )
|
||||||
{
|
{
|
||||||
my $posValue;
|
my $posValue;
|
||||||
@ -3283,17 +3295,15 @@ sub CheckIfShuttersWindowRecOpen($) {
|
|||||||
my $shuttersDev = shift;
|
my $shuttersDev = shift;
|
||||||
$shutters->setShuttersDev($shuttersDev);
|
$shutters->setShuttersDev($shuttersDev);
|
||||||
|
|
||||||
if ( $shutters->getWinStatus eq 'open'
|
if ( $shutters->getWinStatus =~ /open/ ) # CK: covers: open|opened
|
||||||
or $shutters->getWinStatus eq 'opened' )
|
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
elsif ( $shutters->getWinStatus eq 'tilted'
|
elsif ( $shutters->getWinStatus =~ /tilt/ and $shutters->getSubTyp eq 'threestate' ) # CK: covers: tilt|tilted
|
||||||
and $shutters->getSubTyp eq 'threestate' )
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
elsif ( $shutters->getWinStatus eq 'closed' ) { return 0; }
|
elsif ( $shutters->getWinStatus =~ /close/ ) { return 0; } # CK: covers: close|closed
|
||||||
}
|
}
|
||||||
|
|
||||||
sub makeReadingName($) {
|
sub makeReadingName($) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user