Beachtung WindesRec_Subtype hinzugefügt, einige bugfixes

This commit is contained in:
Marko Oldenburg 2018-09-03 13:01:48 +02:00
parent 47df78a4be
commit c075345581

View File

@ -41,7 +41,7 @@ use warnings;
my $version = "0.0.50";
my $version = "0.0.53";
sub AutoShuttersControl_Initialize($) {
@ -534,21 +534,22 @@ sub WindowRecEventProcessing($@) {
if($events =~ m#state:\s(open|closed|tilted)# ) {
my ($openPos,$closedPos,$closedPosWinRecTilted) = ShuttersReadAttrForShuttersControl($shuttersDev);
my $queryShuttersPosWinRecTilted = (ShuttersPosCmdValueNegieren($shuttersDev) ? "ReadingsVal($shuttersDev,AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct'),0) > $closedPosWinRecTilted" : "ReadingsVal($shuttersDev,AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct'),0) < $closedPosWinRecTilted");
my $queryShuttersPosWinRecTilted = (ShuttersPosCmdValueNegieren($shuttersDev) ? ReadingsVal($shuttersDev,AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct'),0) > $closedPosWinRecTilted : ReadingsVal($shuttersDev,AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct'),0) < $closedPosWinRecTilted);
if(ReadingsVal($shuttersDev,'.AutoShuttersControl_DelayCmd','none') ne 'none') {
if(ReadingsVal($shuttersDev,'.AutoShuttersControl_DelayCmd','none') ne 'none') { # Es wird geschaut ob wärend der Fenster offen Phase ein Fahrbefehl über das Modul kam, wenn ja wird dieser aus geführt
my ($openPos,$closedPos,$closedPosWinRecTilted) = ShuttersReadAttrForShuttersControl($shuttersDev);
### Es wird ausgewertet ob ein normaler Fensterkontakt oder ein Drehgriff vorhanden ist. Beim normalen Fensterkontakt bedeutet ein open das selbe wie tilted beim Drehgriffkontakt.
if( $1 eq 'closed' ) {
ShuttersCommandSet($shuttersDev,ReadingsVal($shuttersDev,'.AutoShuttersControl_DelayCmd',0));
} elsif( $1 eq 'tilted' and AttrVal($shuttersDev,'AutoShuttersControl_Ventilate_Window_Open','off') eq 'on' and $queryShuttersPosWinRecTilted ) {
} elsif( ($1 eq 'tilted' or ($1 eq 'open' and AttrVal($shuttersDev,'AutoShuttersControl_WindowRec_subType','twostate') eq 'twostate')) and AttrVal($shuttersDev,'AutoShuttersControl_Ventilate_Window_Open','off') eq 'on' and $queryShuttersPosWinRecTilted ) {
ShuttersCommandSet($shuttersDev,$closedPosWinRecTilted);
}
} 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
ShuttersCommandSet($shuttersDev,$closedPos) if(ReadingsVal($shuttersDev,AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct'),0) == $closedPosWinRecTilted);
} elsif( $1 eq 'tilted' and AttrVal($shuttersDev,'AutoShuttersControl_Ventilate_Window_Open','off') eq 'on' and $queryShuttersPosWinRecTilted ) {
} elsif( ($1 eq 'tilted' or ($1 eq 'open' and AttrVal($shuttersDev,'AutoShuttersControl_WindowRec_subType','twostate') eq 'twostate')) and AttrVal($shuttersDev,'AutoShuttersControl_Ventilate_Window_Open','off') eq 'on' and $queryShuttersPosWinRecTilted ) {
ShuttersCommandSet($shuttersDev,$closedPosWinRecTilted);
}
}
@ -578,7 +579,7 @@ sub RoommateEventProcessing($@) {
}
if( AttrVal($shuttersDev,'AutoShuttersControl_Mode_Down','off') eq 'always' ) {
if( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 ) {
if( CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and AttrVal($shuttersDev,'AutoShuttersControl_WindowRec_subType','twostate') eq 'threestate') {
Log3 $name, 4, "AutoShuttersControl ($name) - RoommateEventProcessing Fenster offen";
ShuttersCommandDelaySet($shuttersDev,$closedPos);
Log3 $name, 4, "AutoShuttersControl ($name) - RoommateEventProcessing - Spring in ShuttersCommandDelaySet";