This commit is contained in:
Marko Oldenburg
2018-11-19 09:06:50 +01:00
parent 23705c6f10
commit 1acd3e35da

View File

@@ -177,25 +177,25 @@ my %userAttrList = (
# => 85, # => 85,
'ASC_Shading_Brightness_Sensor' => 'none', 'ASC_Shading_Brightness_Sensor' => 'none',
'ASC_Shading_Brightness_Reading' => 'brightness', 'ASC_Shading_Brightness_Reading' => 'brightness',
# #
# 'ASC_Shading_StateChange_Sunny' => '6000', # 'ASC_Shading_StateChange_Sunny' => '6000',
# 'ASC_Shading_StateChange_Cloudy' => '4000', # 'ASC_Shading_StateChange_Cloudy' => '4000',
# 'ASC_Shading_WaitingPeriod' => 20, # 'ASC_Shading_WaitingPeriod' => 20,
# 'ASC_Shading_Min_Elevation' => 'none', # 'ASC_Shading_Min_Elevation' => 'none',
# 'ASC_Shading_Min_OutsideTemperature' => 18, # 'ASC_Shading_Min_OutsideTemperature' => 18,
# 'ASC_Shading_BlockingTime_After_Manual' => 20, # 'ASC_Shading_BlockingTime_After_Manual' => 20,
# 'ASC_Shading_BlockingTime_Twilight' => 45, # 'ASC_Shading_BlockingTime_Twilight' => 45,
# '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,
'ASC_WindowRec_subType:twostate,threestate' => 'twostate', 'ASC_WindowRec_subType:twostate,threestate' => 'twostate',
'ASC_ShuttersPlace:window,terrace' => 'window', 'ASC_ShuttersPlace:window,terrace' => 'window',
'ASC_Ventilate_Pos:10,20,30,40,50,60,70,80,90,100' => [ '', 70, 30 ], 'ASC_Ventilate_Pos:10,20,30,40,50,60,70,80,90,100' => [ '', 70, 30 ],
'ASC_ComfortOpen_Pos:0,10,20,30,40,50,60,70,80,90,100' => 'ASC_ComfortOpen_Pos:0,10,20,30,40,50,60,70,80,90,100' => [ '', 20, 80 ],
[ '', 20, 80 ],
'ASC_GuestRoom:on,off' => 'none', 'ASC_GuestRoom:on,off' => 'none',
'ASC_Antifreeze:off,soft,hard,am,pm' => 'off', 'ASC_Antifreeze:off,soft,hard,am,pm' => 'off',
'ASC_Antifreeze_Pos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100' => [ '', 85, 15 ], 'ASC_Antifreeze_Pos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100'
=> [ '', 85, 15 ],
'ASC_Partymode:on,off' => 'off', 'ASC_Partymode:on,off' => 'off',
'ASC_Roommate_Device' => 'none', 'ASC_Roommate_Device' => 'none',
'ASC_Roommate_Reading' => 'state', 'ASC_Roommate_Reading' => 'state',
@@ -384,8 +384,7 @@ sub Notify($$) {
'AutoShuttersControl::RenewSunRiseSetShuttersTimer', 'AutoShuttersControl::RenewSunRiseSetShuttersTimer',
$hash ); $hash );
InternalTimer( gettimeofday() + 5, InternalTimer( gettimeofday() + 5,
'AutoShuttersControl::AutoSearchTwilightDev', 'AutoShuttersControl::AutoSearchTwilightDev', $hash );
$hash );
} }
} }
elsif ( grep /^partyMode:.off$/, @{$events} ) { elsif ( grep /^partyMode:.off$/, @{$events} ) {
@@ -453,7 +452,8 @@ sub EventProcessingGeneral($$$) {
$deviceAttr eq 'ASC_Shading_Brightness_Sensor' $deviceAttr eq 'ASC_Shading_Brightness_Sensor'
and ( $shutters->getDown eq 'brightness' and ( $shutters->getDown eq 'brightness'
or $shutters->getUp eq 'brightness' ) or $shutters->getUp eq 'brightness' )
) { )
{
EventProcessingBrightness( $hash, $device, $events ); EventProcessingBrightness( $hash, $device, $events );
} }
elsif ( $deviceAttr eq 'ASC_Shading_Brightness_Sensor' ) { elsif ( $deviceAttr eq 'ASC_Shading_Brightness_Sensor' ) {
@@ -643,17 +643,18 @@ sub ShuttersDeviceScan($) {
; # temporär muss später gelöscht werden ab Version 0.2.0.6 ; # temporär muss später gelöscht werden ab Version 0.2.0.6
delFromDevAttrList( $_, 'ASC_lock-outCmd:inhibit,blocked' ) delFromDevAttrList( $_, 'ASC_lock-outCmd:inhibit,blocked' )
; # temporär muss später gelöscht werden ab Version 0.2.0.6 ; # temporär muss später gelöscht werden ab Version 0.2.0.6
delFromDevAttrList( $_, 'ASC_Pos_after_ComfortOpen:0,10,20,30,40,50,60,70,80,90,100' ) delFromDevAttrList( $_,
'ASC_Pos_after_ComfortOpen:0,10,20,30,40,50,60,70,80,90,100' )
; # temporär muss später gelöscht werden ab Version 0.2.0.6 ; # temporär muss später gelöscht werden ab Version 0.2.0.6
delFromDevAttrList( $_, 'ASC_Antifreeze:off,on' ) delFromDevAttrList( $_, 'ASC_Antifreeze:off,on' )
if ( AttrVal( $_, 'ASC_Antifreeze', 'on' ) eq 'on' if ( AttrVal( $_, 'ASC_Antifreeze', 'on' ) eq 'on'
or AttrVal( $_, 'ASC_Antifreeze', 'on' ) eq 'off' or AttrVal( $_, 'ASC_Antifreeze', 'on' ) eq 'off' )
)
; # temporär muss später gelöscht werden ab Version 0.2.0.6 ; # temporär muss später gelöscht werden ab Version 0.2.0.6
delFromDevAttrList( $_, 'ASC_AntifreezePos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100' ) delFromDevAttrList( $_,
; # temporär muss später gelöscht werden ab Version 0.2.0.7 'ASC_AntifreezePos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100'
); # temporär muss später gelöscht werden ab Version 0.2.0.7
$shuttersList = $shuttersList . ',' . $_; $shuttersList = $shuttersList . ',' . $_;
$shutters->setShuttersDev($_); $shutters->setShuttersDev($_);
@@ -663,9 +664,9 @@ sub ShuttersDeviceScan($) {
$shutters->setNoOffset(0); $shutters->setNoOffset(0);
$shutters->setPosSetCmd( $posSetCmds{ $defs{$_}->{TYPE} } ); $shutters->setPosSetCmd( $posSetCmds{ $defs{$_}->{TYPE} } );
} }
# $hash->{NOTIFYDEV} = $hash->{NOTIFYDEV} . $shuttersList;
$hash->{NOTIFYDEV} = "global," . $name . $shuttersList;
# $hash->{NOTIFYDEV} = $hash->{NOTIFYDEV} . $shuttersList;
$hash->{NOTIFYDEV} = "global," . $name . $shuttersList;
if ( $ascDev->getMonitoredDevs ne 'none' ) { if ( $ascDev->getMonitoredDevs ne 'none' ) {
$hash->{monitoredDevs} = $hash->{monitoredDevs} =
@@ -834,10 +835,11 @@ sub EventProcessingWindowRec($@) {
if ( $shutters->getDelayCmd ne 'none' and $1 eq 'closed' ) if ( $shutters->getDelayCmd ne 'none' and $1 eq 'closed' )
{ # Es wird geschaut ob wärend der Fenster offen Phase ein Fahrbefehl über das Modul kam,wenn ja wird dieser aus geführt { # Es wird geschaut ob wärend der Fenster offen Phase ein Fahrbefehl über das Modul kam,wenn ja wird dieser aus geführt
# if ( $1 eq 'closed' ) {
# if ( $1 eq 'closed' ) {
$shutters->setLastDrive('delayed drive - window closed'); $shutters->setLastDrive('delayed drive - window closed');
ShuttersCommandSet( $hash, $shuttersDev, ShuttersCommandSet( $hash, $shuttersDev, $shutters->getDelayCmd );
$shutters->getDelayCmd );
# } # }
# elsif ( # elsif (
# ( # (
@@ -860,16 +862,20 @@ sub EventProcessingWindowRec($@) {
or $shutters->getStatus == $shutters->getComfortOpenPos ) or $shutters->getStatus == $shutters->getComfortOpenPos )
{ {
my $homemode = $shutters->getRoommatesStatus; my $homemode = $shutters->getRoommatesStatus;
$homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' ); $homemode = $ascDev->getResidentsStatus
if ( $homemode eq 'none' );
$shutters->setLastDrive('window closed'); $shutters->setLastDrive('window closed');
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getLastPos ) ShuttersCommandSet( $hash, $shuttersDev, $shutters->getLastPos )
if ( IsDay($hash,$shuttersDev) if (
and ($homemode ne 'asleep' IsDay( $hash, $shuttersDev )
and ( $homemode ne 'asleep'
or $homemode ne 'gotosleep' or $homemode ne 'gotosleep'
or $homemode eq 'none') ); or $homemode eq 'none' )
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getClosedPos ) );
if ( not IsDay($hash,$shuttersDev) ShuttersCommandSet( $hash, $shuttersDev,
$shutters->getClosedPos )
if ( not IsDay( $hash, $shuttersDev )
or $homemode eq 'asleep' or $homemode eq 'asleep'
or $homemode eq 'gotosleep' ); or $homemode eq 'gotosleep' );
} }
@@ -909,10 +915,10 @@ sub EventProcessingRoommate($@) {
if ( $events =~ m#$reading:\s(absent|gotosleep|asleep|awoken|home)# ) { if ( $events =~ m#$reading:\s(absent|gotosleep|asleep|awoken|home)# ) {
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - EventProcessingRoommate: " . $shutters->getRoommatesReading "AutoShuttersControl ($name) - EventProcessingRoommate: "
); . $shutters->getRoommatesReading );
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - EventProcessingRoommate: $shuttersDev und Events $events" "AutoShuttersControl ($name) - EventProcessingRoommate: $shuttersDev und Events $events"
); );
if ( if (
@@ -926,7 +932,7 @@ sub EventProcessingRoommate($@) {
) )
{ {
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - EventProcessingRoommate_1: $shuttersDev und Events $events" "AutoShuttersControl ($name) - EventProcessingRoommate_1: $shuttersDev und Events $events"
); );
if ( if (
( (
@@ -937,7 +943,7 @@ sub EventProcessingRoommate($@) {
) )
{ {
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - EventProcessingRoommate_2: $shuttersDev und Events $events" "AutoShuttersControl ($name) - EventProcessingRoommate_2: $shuttersDev und Events $events"
); );
$shutters->setLastDrive('roommate awoken'); $shutters->setLastDrive('roommate awoken');
ShuttersCommandSet( $hash, $shuttersDev, ShuttersCommandSet( $hash, $shuttersDev,
@@ -968,7 +974,8 @@ sub EventProcessingRoommate($@) {
} }
else { else {
$position = $shutters->getVentilatePos; $position = $shutters->getVentilatePos;
$shutters->setLastDrive($shutters->getLastDrive . ' - ventilate mode'); $shutters->setLastDrive(
$shutters->getLastDrive . ' - ventilate mode' );
} }
ShuttersCommandSet( $hash, $shuttersDev, $position ); ShuttersCommandSet( $hash, $shuttersDev, $position );
@@ -1001,7 +1008,8 @@ sub EventProcessingRoommate($@) {
} }
else { else {
$position = $shutters->getVentilatePos; $position = $shutters->getVentilatePos;
$shutters->setLastDrive($shutters->getLastDrive . ' - ventilate mode'); $shutters->setLastDrive(
$shutters->getLastDrive . ' - ventilate mode' );
} }
ShuttersCommandSet( $hash, $shuttersDev, $position ); ShuttersCommandSet( $hash, $shuttersDev, $position );
@@ -1156,7 +1164,7 @@ sub EventProcessingBrightness($@) {
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$shutters->setShuttersDev($shuttersDev); $shutters->setShuttersDev($shuttersDev);
return EventProcessingShadingBrightness($hash, $shuttersDev, $events) return EventProcessingShadingBrightness( $hash, $shuttersDev, $events )
unless ( unless (
int( gettimeofday() / 86400 ) != int( gettimeofday() / 86400 ) !=
int( computeAlignTime( '24:00', $shutters->getTimeUpEarly ) / 86400 ) int( computeAlignTime( '24:00', $shutters->getTimeUpEarly ) / 86400 )
@@ -1212,9 +1220,15 @@ sub EventProcessingBrightness($@) {
and $ascDev->getSelfDefense eq 'off' and $ascDev->getSelfDefense eq 'off'
or ( $ascDev->getSelfDefense eq 'on' or ( $ascDev->getSelfDefense eq 'on'
and CheckIfShuttersWindowRecOpen($shuttersDev) == 0 ) and CheckIfShuttersWindowRecOpen($shuttersDev) == 0 )
) { )
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getOpenPos ); {
} else { EventProcessingShadingBrightness($hash, $shuttersDev, $events); } ShuttersCommandSet( $hash, $shuttersDev,
$shutters->getOpenPos );
}
else {
EventProcessingShadingBrightness( $hash, $shuttersDev,
$events );
}
} }
} }
elsif ( elsif (
@@ -1247,12 +1261,18 @@ sub EventProcessingBrightness($@) {
if ( $shutters->getModeDown eq $homemode if ( $shutters->getModeDown eq $homemode
or $homemode eq 'none' or $homemode eq 'none'
or $shutters->getModeDown eq 'always' or $shutters->getModeDown eq 'always' )
) { {
ShuttersCommandSet( $hash, $shuttersDev, $shutters->getClosedPos ); ShuttersCommandSet( $hash, $shuttersDev,
} else { EventProcessingShadingBrightness($hash, $shuttersDev, $events); } $shutters->getClosedPos );
} }
} else { EventProcessingShadingBrightness($hash, $shuttersDev, $events); } else {
EventProcessingShadingBrightness( $hash, $shuttersDev,
$events );
}
}
}
else { EventProcessingShadingBrightness( $hash, $shuttersDev, $events ); }
} }
sub EventProcessingShadingBrightness($@) { sub EventProcessingShadingBrightness($@) {
@@ -1262,42 +1282,74 @@ sub EventProcessingShadingBrightness($@) {
my $reading = $shutters->getShadingBrightnessReading; my $reading = $shutters->getShadingBrightnessReading;
if ( $events =~ m#$reading:\s(\d+)# ) { if ( $events =~ m#$reading:\s(\d+)# ) {
ShadingProcessing($hash,$shuttersDev,$ascDev->getAzimuth,$ascDev->getElevation,$1,$ascDev->getOutTemp,$shutters->getDirection,$shutters->getShadingAngleLeft,$shutters->getShadingAngleRight) ShadingProcessing(
if ( $shutters->getShadingMode eq 'on' or $shutters->getShadingMode eq $ascDev->getResidentsStatus and IsDay( $hash, $shuttersDev ) ); $hash, $shuttersDev,
$ascDev->getAzimuth, $ascDev->getElevation,
$1, $ascDev->getOutTemp,
$shutters->getDirection, $shutters->getShadingAngleLeft,
$shutters->getShadingAngleRight
)
if ( $shutters->getShadingMode eq 'on'
or $shutters->getShadingMode eq $ascDev->getResidentsStatus
and IsDay( $hash, $shuttersDev ) );
} }
} }
sub EventProcessingTwilightDevice($@) { sub EventProcessingTwilightDevice($@) {
my ( $hash, $device, $events ) = @_; my ( $hash, $device, $events ) = @_;
# Twilight # Twilight
# azimuth = azimuth = Sonnenwinkel # azimuth = azimuth = Sonnenwinkel
# elevation = elevation = Sonnenhöhe # elevation = elevation = Sonnenhöhe
# #
# Astro # Astro
# SunAz = azimuth = Sonnenwinkel # SunAz = azimuth = Sonnenwinkel
# SunAlt = evaluation = Sonnenhöhe # SunAlt = evaluation = Sonnenhöhe
if ( $events =~ m#(azimuth|evaluation|SunAz|SunAlt):\s(\d+.\d+)# ) { if ( $events =~ m#(azimuth|evaluation|SunAz|SunAlt):\s(\d+.\d+)# ) {
my $name = $device; my $name = $device;
my ($azimuth,$elevation, $outTemp, $brightness); my ( $azimuth, $elevation, $outTemp, $brightness );
$azimuth = $2 if ( $1 eq 'azimuth' or $1 eq 'SunAz' ); $azimuth = $2 if ( $1 eq 'azimuth' or $1 eq 'SunAz' );
$elevation = $2 if ( $1 eq 'evaluation' or $1 eq 'SunAlt' ); $elevation = $2 if ( $1 eq 'evaluation' or $1 eq 'SunAlt' );
$azimuth = $ascDev->getAzimuth if (not defined($azimuth) and not $azimuth ); $azimuth = $ascDev->getAzimuth
$elevation = $ascDev->getElevation if (not defined($elevation) and not $elevation ); if ( not defined($azimuth) and not $azimuth );
$elevation = $ascDev->getElevation
if ( not defined($elevation) and not $elevation );
foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) { foreach my $shuttersDev ( @{ $hash->{helper}{shuttersList} } ) {
$shutters->setShuttersDev($shuttersDev); $shutters->setShuttersDev($shuttersDev);
ShadingProcessing($hash,$shuttersDev,$azimuth,$elevation,$shutters->getBrightness,$ascDev->getOutTemp,$shutters->getDirection,$shutters->getShadingAngleLeft,$shutters->getShadingAngleRight) ShadingProcessing(
if ( ($shutters->getShadingMode eq 'on' or $shutters->getShadingMode eq $ascDev->getResidentsStatus) and IsDay( $hash, $shuttersDev ) ); $hash,
$shuttersDev,
$azimuth,
$elevation,
$shutters->getBrightness,
$ascDev->getOutTemp,
$shutters->getDirection,
$shutters->getShadingAngleLeft,
$shutters->getShadingAngleRight
)
if (
(
$shutters->getShadingMode eq 'on'
or $shutters->getShadingMode eq $ascDev->getResidentsStatus
)
and IsDay( $hash, $shuttersDev )
);
} }
} }
} }
sub ShadingProcessing($@) { sub ShadingProcessing($@) {
my ($hash,$shuttersDev,$azimuth,$elevation,$brightness,$outTemp,$shuttersDirection,$shuttersShadingAngleLeft,$shuttersShadingAngleRight) = @_; my (
$hash, $shuttersDev,
$azimuth, $elevation,
$brightness, $outTemp,
$shuttersDirection, $shuttersShadingAngleLeft,
$shuttersShadingAngleRight
) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
# Log3( $name, 1, # Log3( $name, 1,
@@ -1408,7 +1460,7 @@ sub ShuttersCommandSet($$$) {
$shutters->setDelayCmd($posValue); $shutters->setDelayCmd($posValue);
$ascDev->setDelayCmdReading; $ascDev->setDelayCmdReading;
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - ShuttersCommandSet in Delay"); "AutoShuttersControl ($name) - ShuttersCommandSet in Delay" );
} }
else { else {
$shutters->setDriveCmd($posValue); $shutters->setDriveCmd($posValue);
@@ -1417,7 +1469,8 @@ sub ShuttersCommandSet($$$) {
; # setzt den Wert auf none da der Rolladen nun gesteuert werden kann. ; # setzt den Wert auf none da der Rolladen nun gesteuert werden kann.
$ascDev->setLastPosReading; $ascDev->setLastPosReading;
Log3( $name, 4, Log3( $name, 4,
"AutoShuttersControl ($name) - ShuttersCommandSet setDriveCmd wird aufgerufen"); "AutoShuttersControl ($name) - ShuttersCommandSet setDriveCmd wird aufgerufen"
);
} }
} }
@@ -1555,15 +1608,23 @@ sub wiggle($$) {
if ( $shutters->getShuttersPosCmdValueNegate ) { if ( $shutters->getShuttersPosCmdValueNegate ) {
if ( $shutters->getStatus >= $shutters->getOpenPos / 2 ) { if ( $shutters->getStatus >= $shutters->getOpenPos / 2 ) {
$shutters->setDriveCmd( $shutters->getStatus + $shutters->getWiggleValue ); $shutters->setDriveCmd(
$shutters->getStatus + $shutters->getWiggleValue );
}
else {
$shutters->setDriveCmd(
$shutters->getStatus - $shutters->getWiggleValue );
} }
else { $shutters->setDriveCmd( $shutters->getStatus - $shutters->getWiggleValue ); }
} }
else { else {
if ( $shutters->getStatus >= $shutters->getOpenPos / 2 ) { if ( $shutters->getStatus >= $shutters->getOpenPos / 2 ) {
$shutters->setDriveCmd( $shutters->getStatus - $shutters->getWiggleValue ); $shutters->setDriveCmd(
$shutters->getStatus - $shutters->getWiggleValue );
}
else {
$shutters->setDriveCmd(
$shutters->getStatus + $shutters->getWiggleValue );
} }
else { $shutters->setDriveCmd( $shutters->getStatus + $shutters->getWiggleValue ); }
} }
InternalTimer( gettimeofday() + 60, 'AutoShuttersControl::SetCmdFn', \%h ); InternalTimer( gettimeofday() + 60, 'AutoShuttersControl::SetCmdFn', \%h );
@@ -1588,9 +1649,12 @@ sub SunSetShuttersAfterTimerFn($) {
my $homemode = $shutters->getRoommatesStatus; my $homemode = $shutters->getRoommatesStatus;
$homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' ); $homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' );
if ( $shutters->getModeDown eq $homemode if (
# or $homemode eq 'none' $shutters->getModeDown eq $homemode
or $shutters->getModeDown eq 'always' )
# or $homemode eq 'none'
or $shutters->getModeDown eq 'always'
)
{ {
$shutters->setLastDrive('night close'); $shutters->setLastDrive('night close');
ShuttersCommandSet( $hash, $shuttersDev, $posValue ); ShuttersCommandSet( $hash, $shuttersDev, $posValue );
@@ -1609,9 +1673,12 @@ sub SunRiseShuttersAfterTimerFn($) {
my $homemode = $shutters->getRoommatesStatus; my $homemode = $shutters->getRoommatesStatus;
$homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' ); $homemode = $ascDev->getResidentsStatus if ( $homemode eq 'none' );
if ( $shutters->getModeUp eq $homemode if (
# or $homemode eq 'none' $shutters->getModeUp eq $homemode
or $shutters->getModeUp eq 'always' )
# or $homemode eq 'none'
or $shutters->getModeUp eq 'always'
)
{ {
if ( if (
( (
@@ -2017,55 +2084,42 @@ sub ShuttersSunrise($$$) {
IsWe() IsWe()
and int( gettimeofday() / 86400 ) == int( and int( gettimeofday() / 86400 ) == int(
computeAlignTime( computeAlignTime(
'24:00', '24:00', $shutters->getTimeUpWeHoliday
$shutters->getTimeUpWeHoliday
) )
) / 86400 ) / 86400
) )
{ {
$shuttersSunriseUnixtime = $shuttersSunriseUnixtime =
computeAlignTime( computeAlignTime( '24:00',
'24:00', $shutters->getTimeUpWeHoliday );
$shutters->getTimeUpWeHoliday
);
} }
elsif ( elsif (
int( gettimeofday() / 86400 ) == int( int( gettimeofday() / 86400 ) == int(
computeAlignTime( computeAlignTime(
'24:00', '24:00', $shutters->getTimeUpEarly
$shutters->getTimeUpEarly
) )
) / 86400 ) / 86400
) )
{ {
$shuttersSunriseUnixtime = $shuttersSunriseUnixtime =
computeAlignTime( computeAlignTime( '24:00',
'24:00', $shutters->getTimeUpWeHoliday );
$shutters->getTimeUpWeHoliday
);
} }
else { else {
$shuttersSunriseUnixtime = $shuttersSunriseUnixtime =
computeAlignTime( computeAlignTime( '24:00',
'24:00', $shutters->getTimeUpEarly );
$shutters->getTimeUpEarly
);
} }
} }
else { else {
$shuttersSunriseUnixtime = $shuttersSunriseUnixtime =
computeAlignTime( computeAlignTime( '24:00',
'24:00', $shutters->getTimeUpWeHoliday );
$shutters->getTimeUpWeHoliday
);
} }
} }
else { else {
$shuttersSunriseUnixtime = $shuttersSunriseUnixtime =
computeAlignTime( computeAlignTime( '24:00', $shutters->getTimeUpEarly );
'24:00',
$shutters->getTimeUpEarly
);
} }
} }
elsif ( $shutters->getUp eq 'brightness' ) { elsif ( $shutters->getUp eq 'brightness' ) {
@@ -2331,7 +2385,8 @@ sub setDriveCmd {
} }
elsif ( $posValue == $shutters->getClosedPos ) { elsif ( $posValue == $shutters->getClosedPos ) {
$posValue = $shutters->getAntiFreezePos; $posValue = $shutters->getAntiFreezePos;
$shutters->setLastDrive($shutters->getLastDrive . ' - antifreeze mode'); $shutters->setLastDrive(
$shutters->getLastDrive . ' - antifreeze mode' );
} }
} }
@@ -2408,8 +2463,7 @@ sub setLastPos
return 0; return 0;
} }
sub setLastManPos sub setLastManPos {
{
my ( $self, $position ) = @_; my ( $self, $position ) = @_;
$self->{ $self->{shuttersDev} }{lastManPos}{VAL} = $position $self->{ $self->{shuttersDev} }{lastManPos}{VAL} = $position
@@ -2444,15 +2498,16 @@ sub setInTimerFuncHash {
sub getFreezeStatus { sub getFreezeStatus {
use POSIX qw(strftime); use POSIX qw(strftime);
my $self = shift; my $self = shift;
my $daytime = strftime("%P", localtime()); my $daytime = strftime( "%P", localtime() );
if ( $shutters->getAntiFreeze ne 'off' if ( $shutters->getAntiFreeze ne 'off'
and $ascDev->getOutTemp <= $ascDev->getFreezeTemp ) { and $ascDev->getOutTemp <= $ascDev->getFreezeTemp )
{
if ( $shutters->getAntiFreeze eq 'soft') { if ( $shutters->getAntiFreeze eq 'soft' ) {
return 1; return 1;
} }
elsif ( $shutters->getAntiFreeze eq $daytime elsif ($shutters->getAntiFreeze eq $daytime
or $shutters->getAntiFreeze eq $daytime ) or $shutters->getAntiFreeze eq $daytime )
{ {
return 2; return 2;
@@ -3130,7 +3185,8 @@ sub getMonitoredDevs {
sub getOutTemp { sub getOutTemp {
my $self = shift; my $self = shift;
return ReadingsVal( $ascDev->_getTempSensor, $ascDev->getTempReading, -100 ); return ReadingsVal( $ascDev->_getTempSensor, $ascDev->getTempReading,
-100 );
} }
sub getResidentsStatus { sub getResidentsStatus {
@@ -3157,8 +3213,10 @@ sub getAzimuth {
my $self = shift; my $self = shift;
my $azimuth; my $azimuth;
$azimuth = ReadingsVal( $ascDev->_getTwilightDevice, 'azimuth', -1 ) if ( $defs{$ascDev->_getTwilightDevice}->{TYPE} eq 'Twilight' ); $azimuth = ReadingsVal( $ascDev->_getTwilightDevice, 'azimuth', -1 )
$azimuth = ReadingsVal( $ascDev->_getTwilightDevice, 'SunAz', -1 ) if ( $defs{$ascDev->_getTwilightDevice}->{TYPE} eq 'Astro' ); if ( $defs{ $ascDev->_getTwilightDevice }->{TYPE} eq 'Twilight' );
$azimuth = ReadingsVal( $ascDev->_getTwilightDevice, 'SunAz', -1 )
if ( $defs{ $ascDev->_getTwilightDevice }->{TYPE} eq 'Astro' );
return $azimuth; return $azimuth;
} }
@@ -3167,8 +3225,10 @@ sub getElevation {
my $self = shift; my $self = shift;
my $elevation; my $elevation;
$elevation = ReadingsVal( $ascDev->_getTwilightDevice, 'elevation', -1 ) if ( $defs{$ascDev->_getTwilightDevice}->{TYPE} eq 'Twilight' ); $elevation = ReadingsVal( $ascDev->_getTwilightDevice, 'elevation', -1 )
$elevation = ReadingsVal( $ascDev->_getTwilightDevice, 'SunAlt', -1 ) if ( $defs{$ascDev->_getTwilightDevice}->{TYPE} eq 'Astro' ); if ( $defs{ $ascDev->_getTwilightDevice }->{TYPE} eq 'Twilight' );
$elevation = ReadingsVal( $ascDev->_getTwilightDevice, 'SunAlt', -1 )
if ( $defs{ $ascDev->_getTwilightDevice }->{TYPE} eq 'Astro' );
return $elevation; return $elevation;
} }