merge last master changes
This commit is contained in:
@@ -41,7 +41,7 @@ package main;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my $version = '0.4.0.10beta3';
|
my $version = '0.4.0.11beta3';
|
||||||
|
|
||||||
sub AutoShuttersControl_Initialize($) {
|
sub AutoShuttersControl_Initialize($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@@ -856,14 +856,19 @@ sub EventProcessingRoommate($@) {
|
|||||||
"AutoShuttersControl ($name) - EventProcessingRoommate: $shuttersDev und Events $events"
|
"AutoShuttersControl ($name) - EventProcessingRoommate: $shuttersDev und Events $events"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my $getModeUp = $shutters->getModeUp;
|
||||||
|
my $getModeDown = $shutters->getModeDown;
|
||||||
|
my $getRoommatesLastStatus = $shutters->getRoommatesLastStatus
|
||||||
|
|
||||||
if (
|
if (
|
||||||
( $1 eq 'home' or $1 eq 'awoken' )
|
( $1 eq 'home' or $1 eq 'awoken' )
|
||||||
and ( $shutters->getRoommatesStatus eq 'home'
|
and ( $shutters->getRoommatesStatus eq 'home'
|
||||||
or $shutters->getRoommatesStatus eq 'awoken' )
|
or $shutters->getRoommatesStatus eq 'awoken' )
|
||||||
and $ascDev->getAutoShuttersControlMorning eq 'on'
|
and $ascDev->getAutoShuttersControlMorning eq 'on'
|
||||||
|
and ( $getModeUp eq 'home'
|
||||||
and ( $shutters->getModeUp eq 'always'
|
or $getModeUp eq 'always'
|
||||||
or $shutters->getModeUp eq 'home' )
|
or $getModeDown eq 'home'
|
||||||
|
or $getModeDown eq 'always' )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Log3( $name, 4,
|
Log3( $name, 4,
|
||||||
@@ -871,11 +876,13 @@ sub EventProcessingRoommate($@) {
|
|||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
$shutters->getRoommatesLastStatus eq 'asleep'
|
$getRoommatesLastStatus eq 'asleep'
|
||||||
or $shutters->getRoommatesLastStatus eq 'awoken'
|
or $getRoommatesLastStatus eq 'awoken'
|
||||||
)
|
)
|
||||||
and IsDay( $hash, $shuttersDev )
|
and IsDay( $hash, $shuttersDev )
|
||||||
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
||||||
|
and ( $getModeUp eq 'home'
|
||||||
|
or $getModeUp eq 'always' )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Log3( $name, 4,
|
Log3( $name, 4,
|
||||||
@@ -888,19 +895,18 @@ sub EventProcessingRoommate($@) {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
$shutters->getRoommatesLastStatus eq 'absent'
|
$getRoommatesLastStatus eq 'absent'
|
||||||
or $shutters->getRoommatesLastStatus eq 'gone'
|
or $getRoommatesLastStatus eq 'gone'
|
||||||
or $shutters->getRoommatesLastStatus eq 'home'
|
or $getRoommatesLastStatus eq 'home'
|
||||||
)
|
)
|
||||||
and ( $shutters->getModeUp eq 'home'
|
|
||||||
or $shutters->getModeUp eq 'always'
|
|
||||||
or $shutters->getModeDown eq 'home'
|
|
||||||
or $shutters->getModeDown eq 'always' )
|
|
||||||
and $shutters->getRoommatesStatus eq 'home'
|
and $shutters->getRoommatesStatus eq 'home'
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( not IsDay( $hash, $shuttersDev )
|
if ( not IsDay( $hash, $shuttersDev )
|
||||||
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev ) )
|
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
||||||
|
and ( $getModeDown eq 'home'
|
||||||
|
or $getModeDown eq 'always' )
|
||||||
|
)
|
||||||
{
|
{
|
||||||
my $position;
|
my $position;
|
||||||
$shutters->setLastDrive('roommate home');
|
$shutters->setLastDrive('roommate home');
|
||||||
@@ -920,7 +926,9 @@ sub EventProcessingRoommate($@) {
|
|||||||
}
|
}
|
||||||
elsif ( IsDay( $hash, $shuttersDev )
|
elsif ( IsDay( $hash, $shuttersDev )
|
||||||
and $shutters->getStatus == $shutters->getClosedPos
|
and $shutters->getStatus == $shutters->getClosedPos
|
||||||
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev ) )
|
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
||||||
|
and ( $getModeUp eq 'home'
|
||||||
|
or $getModeUp eq 'always') )
|
||||||
{
|
{
|
||||||
$shutters->setLastDrive('roommate home');
|
$shutters->setLastDrive('roommate home');
|
||||||
ShuttersCommandSet( $hash, $shuttersDev,
|
ShuttersCommandSet( $hash, $shuttersDev,
|
||||||
@@ -930,8 +938,8 @@ sub EventProcessingRoommate($@) {
|
|||||||
}
|
}
|
||||||
elsif (
|
elsif (
|
||||||
(
|
(
|
||||||
$shutters->getModeDown eq 'always'
|
$getModeDown eq 'always'
|
||||||
or $shutters->getModeDown eq 'home'
|
or $getModeDown eq 'home'
|
||||||
)
|
)
|
||||||
and ( $1 eq 'gotosleep' or $1 eq 'asleep' )
|
and ( $1 eq 'gotosleep' or $1 eq 'asleep' )
|
||||||
and $ascDev->getAutoShuttersControlEvening eq 'on'
|
and $ascDev->getAutoShuttersControlEvening eq 'on'
|
||||||
@@ -953,7 +961,7 @@ sub EventProcessingRoommate($@) {
|
|||||||
|
|
||||||
ShuttersCommandSet( $hash, $shuttersDev, $position );
|
ShuttersCommandSet( $hash, $shuttersDev, $position );
|
||||||
}
|
}
|
||||||
elsif ( $shutters->getModeDown eq 'absent'
|
elsif ( $getModeDown eq 'absent'
|
||||||
and $1 eq 'absent'
|
and $1 eq 'absent'
|
||||||
and not IsDay( $hash, $shuttersDev ) )
|
and not IsDay( $hash, $shuttersDev ) )
|
||||||
{
|
{
|
||||||
@@ -969,6 +977,10 @@ sub EventProcessingResidents($@) {
|
|||||||
my $name = $device;
|
my $name = $device;
|
||||||
my $reading = $ascDev->getResidentsReading;
|
my $reading = $ascDev->getResidentsReading;
|
||||||
|
|
||||||
|
my $getModeUp = $shutters->getModeUp;
|
||||||
|
my $getModeDow = $getModeDown;
|
||||||
|
my $getResidentsLastStatus = $ascDev->getResidentsLastStatus;
|
||||||
|
|
||||||
if ( $events =~ m#$reading:\s(absent)# ) {
|
if ( $events =~ m#$reading:\s(absent)# ) {
|
||||||
foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
|
foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
|
||||||
$shutters->setShuttersDev($shuttersDev);
|
$shutters->setShuttersDev($shuttersDev);
|
||||||
@@ -979,8 +991,8 @@ sub EventProcessingResidents($@) {
|
|||||||
and $shutters->getSelfDefenseExclude eq 'off'
|
and $shutters->getSelfDefenseExclude eq 'off'
|
||||||
or (
|
or (
|
||||||
(
|
(
|
||||||
$shutters->getModeDown eq 'absent'
|
$getModeDown eq 'absent'
|
||||||
or $shutters->getModeDown eq 'always'
|
or $getModeDown eq 'always'
|
||||||
)
|
)
|
||||||
and not IsDay( $hash, $shuttersDev )
|
and not IsDay( $hash, $shuttersDev )
|
||||||
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
||||||
@@ -1013,10 +1025,10 @@ sub EventProcessingResidents($@) {
|
|||||||
}
|
}
|
||||||
elsif (
|
elsif (
|
||||||
$events =~ m#$reading:\s(home)#
|
$events =~ m#$reading:\s(home)#
|
||||||
and ( $ascDev->getResidentsLastStatus eq 'absent'
|
and ( $getResidentsLastStatus eq 'absent'
|
||||||
or $ascDev->getResidentsLastStatus eq 'gone'
|
or $getResidentsLastStatus eq 'gone'
|
||||||
or $ascDev->getResidentsLastStatus eq 'asleep'
|
or $getResidentsLastStatus eq 'asleep'
|
||||||
or $ascDev->getResidentsLastStatus eq 'awoken' )
|
or $getResidentsLastStatus eq 'awoken' )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
|
foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
|
||||||
@@ -1026,10 +1038,10 @@ sub EventProcessingResidents($@) {
|
|||||||
$shutters->getStatus != $shutters->getClosedPos
|
$shutters->getStatus != $shutters->getClosedPos
|
||||||
and not IsDay( $hash, $shuttersDev )
|
and not IsDay( $hash, $shuttersDev )
|
||||||
and $shutters->getRoommatesStatus eq 'none'
|
and $shutters->getRoommatesStatus eq 'none'
|
||||||
and ( $shutters->getModeDown eq 'home'
|
and ( $getModeDown eq 'home'
|
||||||
or $shutters->getModeDown eq 'always' )
|
or $getModeDown eq 'always' )
|
||||||
and ( $ascDev->getResidentsLastStatus ne 'asleep'
|
and ( $getResidentsLastStatus ne 'asleep'
|
||||||
or $ascDev->getResidentsLastStatus ne 'awoken' )
|
or $getResidentsLastStatus ne 'awoken' )
|
||||||
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -1040,10 +1052,10 @@ sub EventProcessingResidents($@) {
|
|||||||
$ascDev->getSelfDefense eq 'on'
|
$ascDev->getSelfDefense eq 'on'
|
||||||
and CheckIfShuttersWindowRecOpen($shuttersDev) != 0
|
and CheckIfShuttersWindowRecOpen($shuttersDev) != 0
|
||||||
and $shutters->getSelfDefenseExclude eq 'off'
|
and $shutters->getSelfDefenseExclude eq 'off'
|
||||||
or ( $ascDev->getResidentsLastStatus eq 'gone'
|
or ( $getResidentsLastStatus eq 'gone'
|
||||||
and $shutters->getShuttersPlace eq 'terrace' )
|
and $shutters->getShuttersPlace eq 'terrace' )
|
||||||
and ( $shutters->getModeUp eq 'absent'
|
and ( $getModeUp eq 'absent'
|
||||||
or $shutters->getModeUp eq 'off' )
|
or $getModeUp eq 'off' )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$shutters->setLastDrive('selfeDefense inactive');
|
$shutters->setLastDrive('selfeDefense inactive');
|
||||||
@@ -1056,13 +1068,13 @@ sub EventProcessingResidents($@) {
|
|||||||
$shutters->getStatus == $shutters->getClosedPos
|
$shutters->getStatus == $shutters->getClosedPos
|
||||||
and IsDay( $hash, $shuttersDev )
|
and IsDay( $hash, $shuttersDev )
|
||||||
and $shutters->getRoommatesStatus eq 'none'
|
and $shutters->getRoommatesStatus eq 'none'
|
||||||
and ( $shutters->getModeUp eq 'home'
|
and ( $getModeUp eq 'home'
|
||||||
or $shutters->getModeUp eq 'always' )
|
or $getModeUp eq 'always' )
|
||||||
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
and IsAfterShuttersTimeBlocking( $hash, $shuttersDev )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( $ascDev->getResidentsLastStatus eq 'asleep'
|
if ( $getResidentsLastStatus eq 'asleep'
|
||||||
or $ascDev->getResidentsLastStatus eq 'awoken' )
|
or $getResidentsLastStatus eq 'awoken' )
|
||||||
{
|
{
|
||||||
$shutters->setLastDrive('residents awoken');
|
$shutters->setLastDrive('residents awoken');
|
||||||
}
|
}
|
||||||
@@ -1445,25 +1457,27 @@ sub ShadingProcessing($@) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $shutters->getShading eq 'out' or $shutters->getShading eq 'in' ) {
|
if ( $shutters->getShading eq 'out' or $shutters->getShading eq 'in' ) {
|
||||||
|
my $getShadingPos = $shutters->getShadingPos;
|
||||||
|
|
||||||
$shutters->setShading( $shutters->getShading )
|
$shutters->setShading( $shutters->getShading )
|
||||||
if ( ( int( gettimeofday() ) - $shutters->getShadingTimestamp ) >=
|
if ( ( int( gettimeofday() ) - $shutters->getShadingTimestamp ) >=
|
||||||
( $shutters->getShadingWaitingPeriod / 2 ) );
|
( $shutters->getShadingWaitingPeriod / 2 ) );
|
||||||
|
|
||||||
if ( $shutters->getShading eq 'in'
|
if ( $shutters->getShading eq 'in'
|
||||||
and $shutters->getShadingPos != $shutters->getStatus )
|
and $getShadingPos != $shutters->getStatus )
|
||||||
{
|
{
|
||||||
my $queryShuttersShadingPos = (
|
my $queryShuttersShadingPos = (
|
||||||
$shutters->getShuttersPosCmdValueNegate
|
$shutters->getShuttersPosCmdValueNegate
|
||||||
? $shutters->getStatus > $shutters->getShadingPos
|
? $shutters->getStatus > $getShadingPos
|
||||||
: $shutters->getStatus < $shutters->getShadingPos
|
: $shutters->getStatus < $getShadingPos
|
||||||
);
|
);
|
||||||
|
|
||||||
$shutters->setLastDrive('shading in');
|
$shutters->setLastDrive('shading in');
|
||||||
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getShadingPos )
|
ShuttersCommandSet( $hash, $shuttersDev, $getShadingPos )
|
||||||
if ( not $queryShuttersShadingPos );
|
if ( not $queryShuttersShadingPos );
|
||||||
}
|
}
|
||||||
elsif ( $shutters->getShading eq 'out'
|
elsif ( $shutters->getShading eq 'out'
|
||||||
and $shutters->getShadingPos == $shutters->getStatus )
|
and $getShadingPos == $shutters->getStatus )
|
||||||
{
|
{
|
||||||
$shutters->setLastDrive('shading out');
|
$shutters->setLastDrive('shading out');
|
||||||
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getLastPos );
|
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getLastPos );
|
||||||
|
Reference in New Issue
Block a user