Bugfix für die Astroberechnung
This commit is contained in:
parent
ad5dc53746
commit
db14a75ac0
@ -42,7 +42,7 @@ use warnings;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
my $version = "0.1.35";
|
my $version = "0.1.39";
|
||||||
|
|
||||||
|
|
||||||
sub AutoShuttersControl_Initialize($) {
|
sub AutoShuttersControl_Initialize($) {
|
||||||
@ -146,6 +146,10 @@ my %userAttrList = ( 'AutoShuttersControl_Mode_Up:absent,always,off'
|
|||||||
'AutoShuttersControl_Mode_Down:absent,always,off' => 'always',
|
'AutoShuttersControl_Mode_Down:absent,always,off' => 'always',
|
||||||
'AutoShuttersControl_Up:time,astro' => 'astro',
|
'AutoShuttersControl_Up:time,astro' => 'astro',
|
||||||
'AutoShuttersControl_Down:time,astro' => 'astro',
|
'AutoShuttersControl_Down:time,astro' => 'astro',
|
||||||
|
'AutoShuttersControl_AutoAstroModeMorning:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON' => 'none',
|
||||||
|
'AutoShuttersControl_AutoAstroModeMorningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9' => 'none',
|
||||||
|
'AutoShuttersControl_AutoAstroModeEvening:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON' => 'none',
|
||||||
|
'AutoShuttersControl_AutoAstroModeEveningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9' => 'none',
|
||||||
'AutoShuttersControl_Open_Pos:0,10,20,30,40,50,60,70,80,90,100' => ['',0,100],
|
'AutoShuttersControl_Open_Pos:0,10,20,30,40,50,60,70,80,90,100' => ['',0,100],
|
||||||
'AutoShuttersControl_Closed_Pos:0,10,20,30,40,50,60,70,80,90,100' => ['',100,0],
|
'AutoShuttersControl_Closed_Pos:0,10,20,30,40,50,60,70,80,90,100' => ['',100,0],
|
||||||
'AutoShuttersControl_Pos_Cmd' => ['','position','pct'],
|
'AutoShuttersControl_Pos_Cmd' => ['','position','pct'],
|
||||||
@ -156,7 +160,7 @@ my %userAttrList = ( 'AutoShuttersControl_Mode_Up:absent,always,off'
|
|||||||
'AutoShuttersControl_Time_Down_Early' => '15:30:00',
|
'AutoShuttersControl_Time_Down_Early' => '15:30:00',
|
||||||
'AutoShuttersControl_Time_Down_Late' => '22:30:00',
|
'AutoShuttersControl_Time_Down_Late' => '22:30:00',
|
||||||
'AutoShuttersControl_Rand_Minutes' => 20,
|
'AutoShuttersControl_Rand_Minutes' => 20,
|
||||||
'AutoShuttersControl_WindowRec' => '',
|
'AutoShuttersControl_WindowRec' => 'none',
|
||||||
'AutoShuttersControl_Ventilate_Window_Open:on,off' => 'on',
|
'AutoShuttersControl_Ventilate_Window_Open:on,off' => 'on',
|
||||||
'AutoShuttersControl_lock-out:on,off' => 'off',
|
'AutoShuttersControl_lock-out:on,off' => 'off',
|
||||||
'AutoShuttersControl_Shading_Pos:10,20,30,40,50,60,70,80,90,100' => 30,
|
'AutoShuttersControl_Shading_Pos:10,20,30,40,50,60,70,80,90,100' => 30,
|
||||||
@ -164,26 +168,26 @@ my %userAttrList = ( 'AutoShuttersControl_Mode_Up:absent,always,off'
|
|||||||
'AutoShuttersControl_Shading_Pos_after_Shading:-1,0,10,20,30,40,50,60,70,80,90,100' => -1,
|
'AutoShuttersControl_Shading_Pos_after_Shading:-1,0,10,20,30,40,50,60,70,80,90,100' => -1,
|
||||||
'AutoShuttersControl_Shading_Angle_Left:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90' => 85,
|
'AutoShuttersControl_Shading_Angle_Left:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90' => 85,
|
||||||
'AutoShuttersControl_Shading_Angle_Right:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90' => 85,
|
'AutoShuttersControl_Shading_Angle_Right:0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90' => 85,
|
||||||
'AutoShuttersControl_Shading_Brightness_Sensor' => '',
|
'AutoShuttersControl_Shading_Brightness_Sensor' => 'none',
|
||||||
'AutoShuttersControl_Shading_Brightness_Reading' => 'brightness',
|
'AutoShuttersControl_Shading_Brightness_Reading' => 'brightness',
|
||||||
'AutoShuttersControl_Shading_StateChange_Sunny' => '6000',
|
'AutoShuttersControl_Shading_StateChange_Sunny' => '6000',
|
||||||
'AutoShuttersControl_Shading_StateChange_Cloudy' => '4000',
|
'AutoShuttersControl_Shading_StateChange_Cloudy' => '4000',
|
||||||
'AutoShuttersControl_Shading_WaitingPeriod' => 20,
|
'AutoShuttersControl_Shading_WaitingPeriod' => 20,
|
||||||
'AutoShuttersControl_Shading_Min_Elevation' => '',
|
'AutoShuttersControl_Shading_Min_Elevation' => 'none',
|
||||||
'AutoShuttersControl_Shading_Min_OutsideTemperature' => 18,
|
'AutoShuttersControl_Shading_Min_OutsideTemperature' => 18,
|
||||||
'AutoShuttersControl_Shading_BlockingTime_After_Manual' => 20,
|
'AutoShuttersControl_Shading_BlockingTime_After_Manual' => 20,
|
||||||
'AutoShuttersControl_Shading_BlockingTime_Twilight' => 45,
|
'AutoShuttersControl_Shading_BlockingTime_Twilight' => 45,
|
||||||
'AutoShuttersControl_Shading_Fast_Open:on,off' => '',
|
'AutoShuttersControl_Shading_Fast_Open:on,off' => 'none',
|
||||||
'AutoShuttersControl_Shading_Fast_Close:on,off' => '',
|
'AutoShuttersControl_Shading_Fast_Close:on,off' => 'none',
|
||||||
'AutoShuttersControl_Offset_Minutes_Morning' => 1,
|
'AutoShuttersControl_Offset_Minutes_Morning' => 1,
|
||||||
'AutoShuttersControl_Offset_Minutes_Evening' => 1,
|
'AutoShuttersControl_Offset_Minutes_Evening' => 1,
|
||||||
'AutoShuttersControl_WindowRec_subType:twostate,threestate' => 'twostate',
|
'AutoShuttersControl_WindowRec_subType:twostate,threestate' => 'twostate',
|
||||||
'AutoShuttersControl_Ventilate_Pos:10,20,30,40,50,60,70,80,90,100' => ['',70,30],
|
'AutoShuttersControl_Ventilate_Pos:10,20,30,40,50,60,70,80,90,100' => ['',70,30],
|
||||||
'AutoShuttersControl_Pos_after_ComfortOpen:0,10,20,30,40,50,60,70,80,90,100' => ['',20,80],
|
'AutoShuttersControl_Pos_after_ComfortOpen:0,10,20,30,40,50,60,70,80,90,100' => ['',20,80],
|
||||||
'AutoShuttersControl_GuestRoom:on,off' => '',
|
'AutoShuttersControl_GuestRoom:on,off' => 'none',
|
||||||
'AutoShuttersControl_Antifreeze:off,on' => 'off',
|
'AutoShuttersControl_Antifreeze:off,on' => 'off',
|
||||||
'AutoShuttersControl_Partymode:on,off' => 'off',
|
'AutoShuttersControl_Partymode:on,off' => 'off',
|
||||||
'AutoShuttersControl_Roommate_Device' => '',
|
'AutoShuttersControl_Roommate_Device' => 'none',
|
||||||
'AutoShuttersControl_Roommate_Reading' => 'state',
|
'AutoShuttersControl_Roommate_Reading' => 'state',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -305,9 +309,9 @@ sub Notify($$) {
|
|||||||
or grep /^MODIFIED.$name$/,@{$events})
|
or grep /^MODIFIED.$name$/,@{$events})
|
||||||
and $devname eq 'global') {
|
and $devname eq 'global') {
|
||||||
|
|
||||||
## Ist der Event ein globaler und passt zum Rest der Abfrage oben wird nach neuen Rolläden Devices gescannt und eine Liste im Rolladenmodul sortiert nach Raum generiert
|
|
||||||
readingsSingleUpdate($hash,'partyMode','off',0) if(ReadingsVal($name,'partyMode','none') eq 'none');
|
readingsSingleUpdate($hash,'partyMode','off',0) if(ReadingsVal($name,'partyMode','none') eq 'none');
|
||||||
|
|
||||||
|
## Ist der Event ein globaler und passt zum Rest der Abfrage oben wird nach neuen Rolläden Devices gescannt und eine Liste im Rolladenmodul sortiert nach Raum generiert
|
||||||
ShuttersDeviceScan($hash)
|
ShuttersDeviceScan($hash)
|
||||||
unless( ReadingsVal($name,'userAttrList','none') eq 'none');
|
unless( ReadingsVal($name,'userAttrList','none') eq 'none');
|
||||||
|
|
||||||
@ -425,7 +429,6 @@ sub ShuttersDeviceScan($) {
|
|||||||
foreach(@list) {
|
foreach(@list) {
|
||||||
push (@{$hash->{helper}{shuttersList}},$_); ## einem Hash wird ein Array zugewiesen welches die Liste der erkannten Rollos beinhaltet
|
push (@{$hash->{helper}{shuttersList}},$_); ## einem Hash wird ein Array zugewiesen welches die Liste der erkannten Rollos beinhaltet
|
||||||
#AddNotifyDev($hash,$_); # Vorerst keine Shutters in NOTIFYDEV
|
#AddNotifyDev($hash,$_); # Vorerst keine Shutters in NOTIFYDEV
|
||||||
Log3 $name, 5, "AutoShuttersControl ($name) - ShuttersList: " . $_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -435,7 +438,6 @@ sub ShuttersDeviceScan($) {
|
|||||||
# Wert des Attributes beinhaltet in diesem Fall immer den Devcenamen von dem auch Events von unserem Modul getriggert werden sollen.
|
# Wert des Attributes beinhaltet in diesem Fall immer den Devcenamen von dem auch Events von unserem Modul getriggert werden sollen.
|
||||||
my ($notifyDevHash) = ExtractNotifyDevfromReadingString($hash,undef); # in der Funktion wird aus dem String ein Hash wo wir über den Devicenamen z.B. FensterLinks ganz einfach den Rest des Strings heraus bekommen. Also welches Rollo und welches Attribut. So wissen wir das es sich um ein Fenster handelt und dem Rollo bla bla zu geordnet wird.
|
my ($notifyDevHash) = ExtractNotifyDevfromReadingString($hash,undef); # in der Funktion wird aus dem String ein Hash wo wir über den Devicenamen z.B. FensterLinks ganz einfach den Rest des Strings heraus bekommen. Also welches Rollo und welches Attribut. So wissen wir das es sich um ein Fenster handelt und dem Rollo bla bla zu geordnet wird.
|
||||||
|
|
||||||
# my $notifyDevString;
|
|
||||||
my $notifyDevString = $hash->{NOTIFYDEV};
|
my $notifyDevString = $hash->{NOTIFYDEV};
|
||||||
|
|
||||||
while( my (undef,$notifyDev) = each %{$notifyDevHash}) {
|
while( my (undef,$notifyDev) = each %{$notifyDevHash}) {
|
||||||
@ -445,7 +447,6 @@ sub ShuttersDeviceScan($) {
|
|||||||
Log3 $name, 5, "AutoShuttersControl ($name) - NotifyDev: " . $notifyDev . ", NotifyDevString: " . $notifyDevString;
|
Log3 $name, 5, "AutoShuttersControl ($name) - NotifyDev: " . $notifyDev . ", NotifyDevString: " . $notifyDevString;
|
||||||
}
|
}
|
||||||
|
|
||||||
# $hash->{NOTIFYDEV} = $hash->{NOTIFYDEV} . $notifyDevString;
|
|
||||||
$hash->{NOTIFYDEV} = $notifyDevString;
|
$hash->{NOTIFYDEV} = $notifyDevString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,9 +623,15 @@ sub RoommateEventProcessing($@) {
|
|||||||
|
|
||||||
|
|
||||||
ShuttersCommandSet($hash,$shuttersDev,$openPos)
|
ShuttersCommandSet($hash,$shuttersDev,$openPos)
|
||||||
if( ($1 eq 'home' or $1 eq 'awoken') and (ReadingsVal(AttrVal($shuttersDev,'AutoShuttersControl_Roommate_Device','none'),'lastState','none') eq 'asleep' or ReadingsVal(AttrVal($shuttersDev,'AutoShuttersControl_Roommate_Device','none'),'lastState','none') eq 'awoken') and AttrVal($name,'AutoShuttersControl_autoShuttersControlMorning','off') eq 'on' and IsDay($hash,$shuttersDev) and AttrVal($shuttersDev,'AutoShuttersControl_Mode_Up','off') eq 'always' );
|
if( ($1 eq 'home' or $1 eq 'awoken') and
|
||||||
|
(ReadingsVal(AttrVal($shuttersDev,'AutoShuttersControl_Roommate_Device','none'),'lastState','none') eq 'asleep' or ReadingsVal(AttrVal($shuttersDev,'AutoShuttersControl_Roommate_Device','none'),'lastState','none') eq 'awoken')
|
||||||
|
and AttrVal($name,'AutoShuttersControl_autoShuttersControlMorning','off') eq 'on'
|
||||||
|
and IsDay($hash,$shuttersDev)
|
||||||
|
and AttrVal($shuttersDev,'AutoShuttersControl_Mode_Up','off') eq 'always' );
|
||||||
|
|
||||||
|
|
||||||
|
if( AttrVal($shuttersDev,'AutoShuttersControl_Mode_Down','off') eq 'always' and ($1 eq 'gotosleep' or $1 eq 'asleep') and AttrVal($name,'AutoShuttersControl_autoShuttersControlEvening','off') eq 'on' ) {
|
||||||
|
|
||||||
my $position;
|
my $position;
|
||||||
if(CheckIfShuttersWindowRecOpen($shuttersDev) == 0 or AttrVal($shuttersDev,'AutoShuttersControl_Ventilate_Window_Open','on') eq 'off') {
|
if(CheckIfShuttersWindowRecOpen($shuttersDev) == 0 or AttrVal($shuttersDev,'AutoShuttersControl_Ventilate_Window_Open','on') eq 'off') {
|
||||||
$position = $closedPos;
|
$position = $closedPos;
|
||||||
@ -633,7 +640,7 @@ sub RoommateEventProcessing($@) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShuttersCommandSet($hash,$shuttersDev,$position)
|
ShuttersCommandSet($hash,$shuttersDev,$position)
|
||||||
if( AttrVal($shuttersDev,'AutoShuttersControl_Mode_Down','off') eq 'always' and ($1 eq 'gotosleep' or $1 eq 'asleep') and AttrVal($name,'AutoShuttersControl_autoShuttersControlEvening','off') eq 'on' );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,25 +672,27 @@ sub ShuttersCommandSet($$$) {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
|
||||||
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
if( (AttrVal($shuttersDev,'AutoShuttersControl_Partymode','off') eq 'on' and ReadingsVal($hash->{NAME},'partyMode','off') eq 'on')
|
if( (AttrVal($shuttersDev,'AutoShuttersControl_Partymode','off') eq 'on' and ReadingsVal($hash->{NAME},'partyMode','off') eq 'on')
|
||||||
or (CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and AttrVal($shuttersDev,'AutoShuttersControl_WindowRec_subType','twostate') eq 'threestate' and AttrVal($name,'AutoShuttersControl_autoShuttersControlComfort','on') eq 'off')
|
or (CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and AttrVal($shuttersDev,'AutoShuttersControl_WindowRec_subType','twostate') eq 'threestate' and AttrVal($name,'AutoShuttersControl_autoShuttersControlComfort','on') eq 'off')
|
||||||
or (CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and AttrVal($shuttersDev,'AutoShuttersControl_lock-out','on') eq 'on')
|
or (CheckIfShuttersWindowRecOpen($shuttersDev) == 2 and AttrVal($shuttersDev,'AutoShuttersControl_lock-out','on') eq 'on')
|
||||||
or (AttrVal($shuttersDev,'AutoShuttersControl_Antifreeze','off') eq 'on' and ReadingsVal(AttrVal($name,'AutoShuttersControl_temperatureSensor','none'),AttrVal($name,'AutoShuttersControl_temperatureReading','temperature'),100) <= AttrVal($name,'AutoShuttersControl_antifreezeTemp',0)) ) {
|
or (AttrVal($shuttersDev,'AutoShuttersControl_Antifreeze','off') eq 'on' and ReadingsVal(AttrVal($name,'AutoShuttersControl_temperatureSensor','none'),AttrVal($name,'AutoShuttersControl_temperatureReading','temperature'),100) <= AttrVal($name,'AutoShuttersControl_antifreezeTemp',0)) ) {
|
||||||
|
|
||||||
ShuttersCommandDelaySet($shuttersDev,$posValue);
|
ShuttersCommandDelaySet($shuttersDev,$posValue);
|
||||||
readingsBeginUpdate($hash);
|
|
||||||
readingsBulkUpdateIfChanged($hash,$shuttersDev.'_lastDelayPosValue',$posValue);
|
readingsBulkUpdateIfChanged($hash,$shuttersDev.'_lastDelayPosValue',$posValue);
|
||||||
readingsEndUpdate($hash,1);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
my $posCmd = AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct');
|
my $posCmd = AttrVal($shuttersDev,'AutoShuttersControl_Pos_Cmd','pct');
|
||||||
|
|
||||||
CommandSet(undef,$shuttersDev . ':FILTER=' . $posCmd . '!=' . $posValue . ' ' . $posCmd . ' ' . $posValue);
|
CommandSet(undef,$shuttersDev . ':FILTER=' . $posCmd . '!=' . $posValue . ' ' . $posCmd . ' ' . $posValue);
|
||||||
readingsSingleUpdate($defs{$shuttersDev},'.AutoShuttersControl_DelayCmd','none',0) if(ReadingsVal($shuttersDev,'.AutoShuttersControl_DelayCmd','none') ne 'none'); # setzt den Wert des Readings auf none da der Rolladen nun gesteuert werden kann. Dieses Reading setzt die Delay Funktion ShuttersCommandDelaySet
|
readingsSingleUpdate($defs{$shuttersDev},'.AutoShuttersControl_DelayCmd','none',0) if(ReadingsVal($shuttersDev,'.AutoShuttersControl_DelayCmd','none') ne 'none'); # setzt den Wert des Readings auf none da der Rolladen nun gesteuert werden kann. Dieses Reading setzt die Delay Funktion ShuttersCommandDelaySet
|
||||||
readingsBeginUpdate($hash);
|
|
||||||
readingsBulkUpdateIfChanged($hash,$shuttersDev.'_lastPosValue',$posValue);
|
readingsBulkUpdateIfChanged($hash,$shuttersDev.'_lastPosValue',$posValue);
|
||||||
readingsEndUpdate($hash,1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readingsEndUpdate($hash,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sub zum späteren ausführen der Steuerbefehle für Rolläden, zum Beispiel weil Fenster noch auf ist
|
# Sub zum späteren ausführen der Steuerbefehle für Rolläden, zum Beispiel weil Fenster noch auf ist
|
||||||
@ -698,24 +707,24 @@ sub ShuttersCommandDelaySet($$) {
|
|||||||
sub CreateSunRiseSetShuttersTimer($$) {
|
sub CreateSunRiseSetShuttersTimer($$) {
|
||||||
|
|
||||||
my ($hash,$shuttersDev) = @_;
|
my ($hash,$shuttersDev) = @_;
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
my $shuttersDevHash = $defs{$shuttersDev};
|
||||||
|
|
||||||
return if( IsDisabled($name) );
|
return if( IsDisabled($name) );
|
||||||
|
|
||||||
|
|
||||||
my $shuttersSunriseUnixtime = ShuttersSunrise($hash,$shuttersDev,'unix');
|
my $shuttersSunriseUnixtime = ShuttersSunrise($hash,$shuttersDev,'unix');
|
||||||
my $shuttersSunsetUnixtime = ShuttersSunset($hash,$shuttersDev,'unix');
|
my $shuttersSunsetUnixtime = ShuttersSunset($hash,$shuttersDev,'unix');
|
||||||
my $shuttersSunriseRealtime = ShuttersSunrise($hash,$shuttersDev,'real');
|
#my $shuttersSunriseRealtime = ShuttersSunrise($hash,$shuttersDev,'real');
|
||||||
my $shuttersSunsetRealtime = ShuttersSunset($hash,$shuttersDev,'real');
|
#my $shuttersSunsetRealtime = ShuttersSunset($hash,$shuttersDev,'real');
|
||||||
|
|
||||||
|
|
||||||
## In jedem Rolladen werden die errechneten Zeiten hinterlegt, es sei denn das autoShuttersControlEvening/Morning auf off steht
|
## In jedem Rolladen werden die errechneten Zeiten hinterlegt, es sei denn das autoShuttersControlEvening/Morning auf off steht
|
||||||
readingsBeginUpdate($defs{$shuttersDev});
|
readingsBeginUpdate($shuttersDevHash);
|
||||||
readingsBulkUpdate( $defs{$shuttersDev},'AutoShuttersControl_Time_Sunset',(AttrVal($name,'AutoShuttersControl_autoShuttersControlEvening','off') eq 'on' ? $shuttersSunsetRealtime : 'AutoShuttersControl off') );
|
readingsBulkUpdate( $shuttersDevHash,'AutoShuttersControl_Time_Sunset',(AttrVal($name,'AutoShuttersControl_autoShuttersControlEvening','off') eq 'on' ? localtime($shuttersSunsetUnixtime) : 'AutoShuttersControl off') );
|
||||||
readingsBulkUpdate($defs{$shuttersDev},'AutoShuttersControl_Time_Sunrise',(AttrVal($name,'AutoShuttersControl_autoShuttersControlMorning','off') eq 'on' ? $shuttersSunriseRealtime : 'AutoShuttersControl off') );
|
readingsBulkUpdate($shuttersDevHash,'AutoShuttersControl_Time_Sunrise',(AttrVal($name,'AutoShuttersControl_autoShuttersControlMorning','off') eq 'on' ? localtime($shuttersSunriseUnixtime) : 'AutoShuttersControl off') );
|
||||||
readingsEndUpdate($defs{$shuttersDev},0);
|
readingsEndUpdate($shuttersDevHash,1);
|
||||||
|
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdateIfChanged($hash,$shuttersDev . '_nextAstroTimeEvent',($shuttersSunriseUnixtime < $shuttersSunsetUnixtime ? localtime($shuttersSunriseUnixtime) : localtime($shuttersSunsetUnixtime)));
|
readingsBulkUpdateIfChanged($hash,$shuttersDev . '_nextAstroTimeEvent',($shuttersSunriseUnixtime < $shuttersSunsetUnixtime ? localtime($shuttersSunriseUnixtime) : localtime($shuttersSunsetUnixtime)));
|
||||||
@ -729,7 +738,7 @@ sub CreateSunRiseSetShuttersTimer($$) {
|
|||||||
my %funcHash = ( hash => $hash, shuttersdevice => $shuttersDev, sunsettime => $shuttersSunsetUnixtime, sunrisetime => $shuttersSunriseUnixtime);
|
my %funcHash = ( hash => $hash, shuttersdevice => $shuttersDev, sunsettime => $shuttersSunsetUnixtime, sunrisetime => $shuttersSunriseUnixtime);
|
||||||
|
|
||||||
## Ich brauche beim löschen des InternalTimer den Hash welchen ich mitgegeben habe, dieser muss gesichert werden
|
## Ich brauche beim löschen des InternalTimer den Hash welchen ich mitgegeben habe, dieser muss gesichert werden
|
||||||
readingsSingleUpdate($defs{$shuttersDev},'.AutoShuttersControl_InternalTimerFuncHash',\%funcHash,0);
|
readingsSingleUpdate($shuttersDevHash,'.AutoShuttersControl_InternalTimerFuncHash',\%funcHash,0);
|
||||||
|
|
||||||
InternalTimer($shuttersSunsetUnixtime, 'AutoShuttersControl::SunSetShuttersAfterTimerFn',\%funcHash ) if( AttrVal($name,'AutoShuttersControl_autoShuttersControlEvening','off') eq 'on' );
|
InternalTimer($shuttersSunsetUnixtime, 'AutoShuttersControl::SunSetShuttersAfterTimerFn',\%funcHash ) if( AttrVal($name,'AutoShuttersControl_autoShuttersControlEvening','off') eq 'on' );
|
||||||
InternalTimer($shuttersSunriseUnixtime, 'AutoShuttersControl::SunRiseShuttersAfterTimerFn',\%funcHash ) if( AttrVal($name,'AutoShuttersControl_autoShuttersControlMorning','off') eq 'on' );
|
InternalTimer($shuttersSunriseUnixtime, 'AutoShuttersControl::SunRiseShuttersAfterTimerFn',\%funcHash ) if( AttrVal($name,'AutoShuttersControl_autoShuttersControlMorning','off') eq 'on' );
|
||||||
@ -741,6 +750,7 @@ sub RenewSunRiseSetShuttersTimer($) {
|
|||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
|
|
||||||
foreach (@{$hash->{helper}{shuttersList}}) {
|
foreach (@{$hash->{helper}{shuttersList}}) {
|
||||||
|
CommandDeleteReading(undef,$_ . ' \.AutoShuttersControl_InternalTimerFuncHash' );
|
||||||
CreateSunRiseSetShuttersTimer($hash,$_);
|
CreateSunRiseSetShuttersTimer($hash,$_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -852,8 +862,16 @@ sub ShuttersSunrise($$$) {
|
|||||||
my ($hash,$shuttersDev,$tm) = @_; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
|
my ($hash,$shuttersDev,$tm) = @_; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $autoAstroMode = AttrVal($name,'AutoShuttersControl_autoAstroModeMorning','REAL');
|
my $autoAstroMode;
|
||||||
|
|
||||||
|
# if( AttrVal($shuttersDev,'AutoShuttersControl_AutoAstroModeMorning','none') ne 'none' ) {
|
||||||
|
# $autoAstroMode = AttrVal($shuttersDev,'AutoShuttersControl_AutoAstroModeMorning','REAL');
|
||||||
|
# $autoAstroMode = $autoAstroMode . '=' . AttrVal($shuttersDev,'AutoShuttersControl_AutoAstroModeMorningHorizon',0) if( $autoAstroMode eq 'HORIZON' );
|
||||||
|
# } else {
|
||||||
|
$autoAstroMode = AttrVal($name,'AutoShuttersControl_autoAstroModeMorning','REAL');
|
||||||
$autoAstroMode = $autoAstroMode . '=' . AttrVal($name,'AutoShuttersControl_autoAstroModeMorningHorizon',0) if( $autoAstroMode eq 'HORIZON' );
|
$autoAstroMode = $autoAstroMode . '=' . AttrVal($name,'AutoShuttersControl_autoAstroModeMorningHorizon',0) if( $autoAstroMode eq 'HORIZON' );
|
||||||
|
# }
|
||||||
|
|
||||||
my $oldFuncHash = ReadingsVal($shuttersDev,'.AutoShuttersControl_InternalTimerFuncHash',0);
|
my $oldFuncHash = ReadingsVal($shuttersDev,'.AutoShuttersControl_InternalTimerFuncHash',0);
|
||||||
my $shuttersSunriseUnixtime;
|
my $shuttersSunriseUnixtime;
|
||||||
|
|
||||||
@ -865,7 +883,7 @@ sub ShuttersSunrise($$$) {
|
|||||||
|
|
||||||
if( defined($oldFuncHash) and ref($oldFuncHash) eq 'HASH') {
|
if( defined($oldFuncHash) and ref($oldFuncHash) eq 'HASH') {
|
||||||
$shuttersSunriseUnixtime = ($shuttersSunriseUnixtime + 86400)
|
$shuttersSunriseUnixtime = ($shuttersSunriseUnixtime + 86400)
|
||||||
unless($shuttersSunriseUnixtime == $oldFuncHash->{sunrisetime} or $shuttersSunriseUnixtime > ($oldFuncHash->{sunrisetime} + 3600));
|
unless( $shuttersSunriseUnixtime > ($oldFuncHash->{sunrisetime} + 900) or $shuttersSunriseUnixtime == $oldFuncHash->{sunrisetime} );
|
||||||
}
|
}
|
||||||
} elsif( AttrVal($shuttersDev,'AutoShuttersControl_Up','astro') eq 'time' ) {
|
} elsif( AttrVal($shuttersDev,'AutoShuttersControl_Up','astro') eq 'time' ) {
|
||||||
|
|
||||||
@ -886,8 +904,16 @@ sub ShuttersSunset($$$) {
|
|||||||
my ($hash,$shuttersDev,$tm) = @_; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
|
my ($hash,$shuttersDev,$tm) = @_; # Tm steht für Timemode und bedeutet Realzeit oder Unixzeit
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $autoAstroMode = AttrVal($name,'AutoShuttersControl_autoAstroModeEvening','REAL');
|
my $autoAstroMode;
|
||||||
|
|
||||||
|
# if( AttrVal($shuttersDev,'AutoShuttersControl_AutoAstroModeEvening','none') ne 'none') {
|
||||||
|
# $autoAstroMode = AttrVal($shuttersDev,'AutoShuttersControl_autoAstroModeEvening','REAL');
|
||||||
|
# $autoAstroMode = $autoAstroMode . '=' . AttrVal($shuttersDev,'AutoShuttersControl_autoAstroModeEveningHorizon',0) if( $autoAstroMode eq 'HORIZON' );
|
||||||
|
# } else {
|
||||||
|
$autoAstroMode = AttrVal($name,'AutoShuttersControl_autoAstroModeEvening','REAL');
|
||||||
$autoAstroMode = $autoAstroMode . '=' . AttrVal($name,'AutoShuttersControl_autoAstroModeEveningHorizon',0) if( $autoAstroMode eq 'HORIZON' );
|
$autoAstroMode = $autoAstroMode . '=' . AttrVal($name,'AutoShuttersControl_autoAstroModeEveningHorizon',0) if( $autoAstroMode eq 'HORIZON' );
|
||||||
|
# }
|
||||||
|
|
||||||
my $oldFuncHash = ReadingsVal($shuttersDev,'.AutoShuttersControl_InternalTimerFuncHash',0);
|
my $oldFuncHash = ReadingsVal($shuttersDev,'.AutoShuttersControl_InternalTimerFuncHash',0);
|
||||||
my $shuttersSunsetUnixtime;
|
my $shuttersSunsetUnixtime;
|
||||||
|
|
||||||
@ -899,7 +925,7 @@ sub ShuttersSunset($$$) {
|
|||||||
|
|
||||||
if( defined($oldFuncHash) and ref($oldFuncHash) eq 'HASH') {
|
if( defined($oldFuncHash) and ref($oldFuncHash) eq 'HASH') {
|
||||||
$shuttersSunsetUnixtime = ($shuttersSunsetUnixtime + 86400)
|
$shuttersSunsetUnixtime = ($shuttersSunsetUnixtime + 86400)
|
||||||
unless($shuttersSunsetUnixtime == $oldFuncHash->{sunsettime} or $shuttersSunsetUnixtime > ($oldFuncHash->{sunsettime} + 3600));
|
unless( $shuttersSunsetUnixtime > ($oldFuncHash->{sunsettime} + 900) or $shuttersSunsetUnixtime == $oldFuncHash->{sunsettime} );
|
||||||
}
|
}
|
||||||
} elsif( AttrVal($shuttersDev,'AutoShuttersControl_Down','astro') eq 'time' ) {
|
} elsif( AttrVal($shuttersDev,'AutoShuttersControl_Down','astro') eq 'time' ) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user