first devel version with shading support
This commit is contained in:
parent
0bf225404e
commit
c7181f449f
@ -182,6 +182,7 @@ my %userAttrList = (
|
|||||||
'ASC_Shading_Min_Elevation' => 25.0,
|
'ASC_Shading_Min_Elevation' => 25.0,
|
||||||
'ASC_Shading_Min_OutsideTemperature' => 18,
|
'ASC_Shading_Min_OutsideTemperature' => 18,
|
||||||
'ASC_Shading_WaitingPeriod' => 1200,
|
'ASC_Shading_WaitingPeriod' => 1200,
|
||||||
|
|
||||||
# 'ASC_Shading_Fast_Open:on,off' => 'none',
|
# 'ASC_Shading_Fast_Open:on,off' => 'none',
|
||||||
# 'ASC_Shading_Fast_Close:on,off' => 'none',
|
# 'ASC_Shading_Fast_Close:on,off' => 'none',
|
||||||
'ASC_Drive_Offset' => -1,
|
'ASC_Drive_Offset' => -1,
|
||||||
@ -270,7 +271,8 @@ sub Define($$) {
|
|||||||
) if ( AttrVal( $name, 'devStateIcon', 'none' ) eq 'none' );
|
) if ( AttrVal( $name, 'devStateIcon', 'none' ) eq 'none' );
|
||||||
|
|
||||||
CommandDeleteReading( undef, $name . ' lockOut' )
|
CommandDeleteReading( undef, $name . ' lockOut' )
|
||||||
if ( ReadingsVal($name,'lockOut','none') ne 'none' ); # temporär ab Version 0.2.2
|
if ( ReadingsVal( $name, 'lockOut', 'none' ) ne 'none' )
|
||||||
|
; # temporär ab Version 0.2.2
|
||||||
|
|
||||||
addToAttrList('ASC:0,1,2');
|
addToAttrList('ASC:0,1,2');
|
||||||
|
|
||||||
@ -1277,9 +1279,13 @@ sub EventProcessingShadingBrightness($@) {
|
|||||||
$shutters->getDirection, $shutters->getShadingAngleLeft,
|
$shutters->getDirection, $shutters->getShadingAngleLeft,
|
||||||
$shutters->getShadingAngleRight
|
$shutters->getShadingAngleRight
|
||||||
)
|
)
|
||||||
if ( ( $shutters->getShadingMode eq 'on'
|
if (
|
||||||
or $shutters->getShadingMode eq $homemode)
|
(
|
||||||
and IsDay( $hash, $shuttersDev ) );
|
$shutters->getShadingMode eq 'on'
|
||||||
|
or $shutters->getShadingMode eq $homemode
|
||||||
|
)
|
||||||
|
and IsDay( $hash, $shuttersDev )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1339,11 +1345,8 @@ sub ShadingProcessing($@) {
|
|||||||
### anglePlus ist $shutters->getShadingAngleRight
|
### anglePlus ist $shutters->getShadingAngleRight
|
||||||
### winPos ist die Fensterposition $shutters->getDirection
|
### winPos ist die Fensterposition $shutters->getDirection
|
||||||
my (
|
my (
|
||||||
$hash, $shuttersDev,
|
$hash, $shuttersDev, $azimuth, $elevation, $brightness,
|
||||||
$azimuth, $elevation,
|
$outTemp, $winPos, $angleMinus, $anglePlus
|
||||||
$brightness, $outTemp,
|
|
||||||
$winPos, $angleMinus,
|
|
||||||
$anglePlus
|
|
||||||
) = @_;
|
) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
$shutters->setShuttersDev($shuttersDev);
|
$shutters->setShuttersDev($shuttersDev);
|
||||||
@ -1352,8 +1355,16 @@ sub ShadingProcessing($@) {
|
|||||||
and $shutters->getShading ne 'out' );
|
and $shutters->getShading ne 'out' );
|
||||||
|
|
||||||
Log3( $name, 1,
|
Log3( $name, 1,
|
||||||
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " . $shuttersDev . " Azimuth: " . $azimuth . " Elevation: " . $elevation . " Brightness: " . $brightness . " OutTemp: " . $outTemp
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
);
|
. $shuttersDev
|
||||||
|
. " Azimuth: "
|
||||||
|
. $azimuth
|
||||||
|
. " Elevation: "
|
||||||
|
. $elevation
|
||||||
|
. " Brightness: "
|
||||||
|
. $brightness
|
||||||
|
. " OutTemp: "
|
||||||
|
. $outTemp );
|
||||||
|
|
||||||
return
|
return
|
||||||
if ( $azimuth == -1
|
if ( $azimuth == -1
|
||||||
@ -1362,12 +1373,14 @@ sub ShadingProcessing($@) {
|
|||||||
or $outTemp == -100
|
or $outTemp == -100
|
||||||
or $outTemp < $shutters->getShadingMinOutsideTemperature
|
or $outTemp < $shutters->getShadingMinOutsideTemperature
|
||||||
or not IsDay( $hash, $shuttersDev )
|
or not IsDay( $hash, $shuttersDev )
|
||||||
or (int(gettimeofday()) - $shutters->getShadingTimestamp) < ($shutters->getShadingWaitingPeriod / 2)
|
or ( int( gettimeofday() ) - $shutters->getShadingTimestamp ) <
|
||||||
or not IsAfterShuttersTimeBlocking($hash,$shuttersDev)
|
( $shutters->getShadingWaitingPeriod / 2 )
|
||||||
);
|
or not IsAfterShuttersTimeBlocking( $hash, $shuttersDev ) );
|
||||||
|
|
||||||
Log3( $name, 1,
|
Log3( $name, 1,
|
||||||
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " . $shuttersDev . " Nach dem return");
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " Nach dem return" );
|
||||||
|
|
||||||
# minimalen und maximalen Winkel des Fensters bestimmen. wenn die aktuelle Sonnenposition z.B. bei 205° läge und der Wert für angleMin/Max 85° wäre, dann würden zwischen 120° und 290° beschattet.
|
# minimalen und maximalen Winkel des Fensters bestimmen. wenn die aktuelle Sonnenposition z.B. bei 205° läge und der Wert für angleMin/Max 85° wäre, dann würden zwischen 120° und 290° beschattet.
|
||||||
my $winPosMin = $winPos - $angleMinus;
|
my $winPosMin = $winPos - $angleMinus;
|
||||||
@ -1384,9 +1397,15 @@ sub ShadingProcessing($@) {
|
|||||||
|
|
||||||
$shutters->setShading('out')
|
$shutters->setShading('out')
|
||||||
if ( $shutters->getShading eq 'out reserved'
|
if ( $shutters->getShading eq 'out reserved'
|
||||||
and (int(gettimeofday()) - $shutters->getShadingTimestamp) >= $shutters->getShadingWaitingPeriod );
|
and ( int( gettimeofday() ) - $shutters->getShadingTimestamp ) >=
|
||||||
|
$shutters->getShadingWaitingPeriod );
|
||||||
Log3( $name, 1,
|
Log3( $name, 1,
|
||||||
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " . $shuttersDev . " In der Out Abfrage, Shadingwert: " . $shutters->getShading . ", Zeitstempel: " . $shutters->getShadingTimestamp);
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " In der Out Abfrage, Shadingwert: "
|
||||||
|
. $shutters->getShading
|
||||||
|
. ", Zeitstempel: "
|
||||||
|
. $shutters->getShadingTimestamp );
|
||||||
}
|
}
|
||||||
elsif ( $azimuth >= $winPosMin
|
elsif ( $azimuth >= $winPosMin
|
||||||
and $azimuth <= $winPosMax
|
and $azimuth <= $winPosMax
|
||||||
@ -1399,14 +1418,21 @@ sub ShadingProcessing($@) {
|
|||||||
|
|
||||||
$shutters->setShading('in')
|
$shutters->setShading('in')
|
||||||
if ( $shutters->getShading eq 'in reserved'
|
if ( $shutters->getShading eq 'in reserved'
|
||||||
and (int(gettimeofday()) - $shutters->getShadingTimestamp) >= ($shutters->getShadingWaitingPeriod / 2) );
|
and ( int( gettimeofday() ) - $shutters->getShadingTimestamp ) >=
|
||||||
|
( $shutters->getShadingWaitingPeriod / 2 ) );
|
||||||
Log3( $name, 1,
|
Log3( $name, 1,
|
||||||
"AutoShuttersControl ($name) - Shading Processing, Rollladen: " . $shuttersDev . " In der In Abfrage, Shadingwert: " . $shutters->getShading . ", Zeitstempel: " . $shutters->getShadingTimestamp);
|
"AutoShuttersControl ($name) - Shading Processing, Rollladen: "
|
||||||
|
. $shuttersDev
|
||||||
|
. " In der In Abfrage, Shadingwert: "
|
||||||
|
. $shutters->getShading
|
||||||
|
. ", Zeitstempel: "
|
||||||
|
. $shutters->getShadingTimestamp );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $shutters->getShading eq 'out' or $shutters->getShading eq 'in' ) {
|
if ( $shutters->getShading eq 'out' or $shutters->getShading eq 'in' ) {
|
||||||
$shutters->setShading( $shutters->getShading )
|
$shutters->setShading( $shutters->getShading )
|
||||||
if ( (int(gettimeofday()) - $shutters->getShadingTimestamp) >= ($shutters->getShadingWaitingPeriod / 2) );
|
if ( ( int( gettimeofday() ) - $shutters->getShadingTimestamp ) >=
|
||||||
|
( $shutters->getShadingWaitingPeriod / 2 ) );
|
||||||
|
|
||||||
if ( $shutters->getShading eq 'in'
|
if ( $shutters->getShading eq 'in'
|
||||||
and $shutters->getShadingPos != $shutters->getStatus )
|
and $shutters->getShadingPos != $shutters->getStatus )
|
||||||
@ -1427,11 +1453,13 @@ sub ShadingProcessing($@) {
|
|||||||
$shutters->setLastDrive('shading out');
|
$shutters->setLastDrive('shading out');
|
||||||
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getLastPos );
|
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getLastPos );
|
||||||
Log3( $name, 1,
|
Log3( $name, 1,
|
||||||
"AutoShuttersControl ($name) - Shading Processing - shading out läuft" );
|
"AutoShuttersControl ($name) - Shading Processing - shading out läuft"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log3( $name, 1,
|
Log3( $name, 1,
|
||||||
"AutoShuttersControl ($name) - Shading Processing - In der Routine zum fahren der Rollläden, Shading Wert: " . $shutters->getShading );
|
"AutoShuttersControl ($name) - Shading Processing - In der Routine zum fahren der Rollläden, Shading Wert: "
|
||||||
|
. $shutters->getShading );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1502,8 +1530,11 @@ sub ShuttersCommandSet($$$) {
|
|||||||
: $shutters->getStatus < $posValue
|
: $shutters->getStatus < $posValue
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( ($posValue != $shutters->getShadingPos
|
if (
|
||||||
and ( $shutters->getPartyMode eq 'on' and $ascDev->getPartyMode eq 'on' )
|
(
|
||||||
|
$posValue != $shutters->getShadingPos
|
||||||
|
and ( $shutters->getPartyMode eq 'on'
|
||||||
|
and $ascDev->getPartyMode eq 'on' )
|
||||||
or ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2
|
or ( CheckIfShuttersWindowRecOpen($shuttersDev) == 2
|
||||||
and $shutters->getSubTyp eq 'threestate'
|
and $shutters->getSubTyp eq 'threestate'
|
||||||
and $ascDev->getAutoShuttersControlComfort eq 'off'
|
and $ascDev->getAutoShuttersControlComfort eq 'off'
|
||||||
@ -1771,11 +1802,9 @@ sub CreateNewNotifyDev($) {
|
|||||||
AddNotifyDev( $hash, AttrVal( $_, 'ASC_WindowRec', 'none' ),
|
AddNotifyDev( $hash, AttrVal( $_, 'ASC_WindowRec', 'none' ),
|
||||||
$_, 'ASC_WindowRec' )
|
$_, 'ASC_WindowRec' )
|
||||||
if ( AttrVal( $_, 'ASC_WindowRec', 'none' ) ne 'none' );
|
if ( AttrVal( $_, 'ASC_WindowRec', 'none' ) ne 'none' );
|
||||||
AddNotifyDev( $hash,
|
AddNotifyDev( $hash, AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ),
|
||||||
AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ),
|
|
||||||
$_, 'ASC_Brightness_Sensor' )
|
$_, 'ASC_Brightness_Sensor' )
|
||||||
if (
|
if ( AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ) ne 'none' );
|
||||||
AttrVal( $_, 'ASC_Brightness_Sensor', 'none' ) ne 'none' );
|
|
||||||
$shuttersList = $shuttersList . ',' . $_;
|
$shuttersList = $shuttersList . ',' . $_;
|
||||||
}
|
}
|
||||||
AddNotifyDev( $hash, AttrVal( $name, 'ASC_residentsDevice', 'none' ),
|
AddNotifyDev( $hash, AttrVal( $name, 'ASC_residentsDevice', 'none' ),
|
||||||
@ -2194,13 +2223,18 @@ sub IsAfterShuttersTimeBlocking($$) {
|
|||||||
$shutters->setShuttersDev($shuttersDev);
|
$shutters->setShuttersDev($shuttersDev);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
( int(gettimeofday()) - $shutters->getLastManPosTimestamp) < $shutters->getBlockingTimeAfterManual
|
( int( gettimeofday() ) - $shutters->getLastManPosTimestamp ) <
|
||||||
|
$shutters->getBlockingTimeAfterManual
|
||||||
or ( not IsDay( $hash, $shuttersDev )
|
or ( not IsDay( $hash, $shuttersDev )
|
||||||
and $shutters->getSunriseUnixTime - (int(gettimeofday())) < $shutters->getBlockingTimeBeforDayOpen)
|
and $shutters->getSunriseUnixTime - ( int( gettimeofday() ) ) <
|
||||||
|
$shutters->getBlockingTimeBeforDayOpen )
|
||||||
or ( IsDay( $hash, $shuttersDev )
|
or ( IsDay( $hash, $shuttersDev )
|
||||||
and $shutters->getSunsetUnixTime - (int(gettimeofday())) < $shutters->getBlockingTimeBeforNightClose)
|
and $shutters->getSunsetUnixTime - ( int( gettimeofday() ) ) <
|
||||||
|
$shutters->getBlockingTimeBeforNightClose )
|
||||||
)
|
)
|
||||||
{ return 0 }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
else { return 1 }
|
else { return 1 }
|
||||||
}
|
}
|
||||||
@ -2567,7 +2601,8 @@ sub setLastManPos {
|
|||||||
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( gettimeofday() )
|
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( gettimeofday() )
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
||||||
and defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
and defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
||||||
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} = int( gettimeofday() ) - 86400
|
$self->{ $self->{shuttersDev} }{lastManPos}{TIME} =
|
||||||
|
int( gettimeofday() ) - 86400
|
||||||
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
if ( defined( $self->{ $self->{shuttersDev} }{lastManPos} )
|
||||||
and not defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
and not defined( $self->{ $self->{shuttersDev} }{lastManPos}{TIME} ) );
|
||||||
return 0;
|
return 0;
|
||||||
@ -2767,8 +2802,7 @@ sub setShading {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getShading
|
sub getShading { # Werte für value = in, out, in reserved, out reserved
|
||||||
{ # Werte für value = in, out, in reserved, out reserved
|
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return $self->{ $self->{shuttersDev} }{Shading}{VAL}
|
return $self->{ $self->{shuttersDev} }{Shading}{VAL}
|
||||||
@ -2855,8 +2889,7 @@ sub _getBrightnessSensor {
|
|||||||
my $default = $self->{defaultarg};
|
my $default = $self->{defaultarg};
|
||||||
|
|
||||||
$default = 'none' if ( not defined($default) );
|
$default = 'none' if ( not defined($default) );
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_Brightness_Sensor',
|
return AttrVal( $self->{shuttersDev}, 'ASC_Brightness_Sensor', $default );
|
||||||
$default );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getBrightnessReading {
|
sub getBrightnessReading {
|
||||||
@ -2864,8 +2897,7 @@ sub getBrightnessReading {
|
|||||||
my $default = $self->{defaultarg};
|
my $default = $self->{defaultarg};
|
||||||
|
|
||||||
$default = 'brightness' if ( not defined($default) );
|
$default = 'brightness' if ( not defined($default) );
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_Brightness_Reading',
|
return AttrVal( $self->{shuttersDev}, 'ASC_Brightness_Reading', $default );
|
||||||
$default );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getDirection {
|
sub getDirection {
|
||||||
@ -2889,7 +2921,8 @@ sub getShadingAngleRight {
|
|||||||
sub getShadingMinOutsideTemperature {
|
sub getShadingMinOutsideTemperature {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_Shading_Min_OutsideTemperature', 2 );
|
return AttrVal( $self->{shuttersDev}, 'ASC_Shading_Min_OutsideTemperature',
|
||||||
|
2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getShadingMinElevation {
|
sub getShadingMinElevation {
|
||||||
@ -2901,13 +2934,15 @@ sub getShadingMinElevation {
|
|||||||
sub getShadingStateChangeSunny {
|
sub getShadingStateChangeSunny {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_Shading_StateChange_Sunny', 5000 );
|
return AttrVal( $self->{shuttersDev}, 'ASC_Shading_StateChange_Sunny',
|
||||||
|
5000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getShadingStateChangeCloudy {
|
sub getShadingStateChangeCloudy {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_Shading_StateChange_Cloudy', 2000 );
|
return AttrVal( $self->{shuttersDev}, 'ASC_Shading_StateChange_Cloudy',
|
||||||
|
2000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getShadingWaitingPeriod {
|
sub getShadingWaitingPeriod {
|
||||||
@ -2926,19 +2961,22 @@ sub getOffset {
|
|||||||
sub getBlockingTimeAfterManual {
|
sub getBlockingTimeAfterManual {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_BlockingTime_afterManual', 1200 );
|
return AttrVal( $self->{shuttersDev}, 'ASC_BlockingTime_afterManual',
|
||||||
|
1200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getBlockingTimeBeforNightClose {
|
sub getBlockingTimeBeforNightClose {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_BlockingTime_beforNightClose', 3600 );
|
return AttrVal( $self->{shuttersDev}, 'ASC_BlockingTime_beforNightClose',
|
||||||
|
3600 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getBlockingTimeBeforDayOpen {
|
sub getBlockingTimeBeforDayOpen {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return AttrVal( $self->{shuttersDev}, 'ASC_BlockingTime_beforDayOpen', 3600 );
|
return AttrVal( $self->{shuttersDev}, 'ASC_BlockingTime_beforDayOpen',
|
||||||
|
3600 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getPosCmd {
|
sub getPosCmd {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user