- dokumentation improved

59_Twilight now supports the function >>>> twilight($twilight, $reading, $min, $max) that works like sunset_abs() sunrise_abs()

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4533 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dietmar63 2014-01-02 20:19:46 +00:00
parent 87ca6d2ed0
commit cc0c85e2b5
5 changed files with 79 additions and 41 deletions

View File

@ -583,6 +583,17 @@ sub Twilight_CompassPoint($) {
return $compassPoint;
}
sub twilight($$$$) {
my ($twilight, $reading, $min, $max) = @_;
my $t = hms2h(ReadingsVal($twilight,$reading,0));
$t = hms2h($min) if(defined($min) && (hms2h($min) > $t));
$t = hms2h($max) if(defined($max) && (hms2h($max) < $t));
return h2hms_fmt($t);
}
1;
=pod
@ -663,30 +674,30 @@ sub Twilight_CompassPoint($) {
<code>get &lt;name&gt; &lt;reading&gt;</code><br><br>
<table>
<tr><td>light</td><td>the current virtual daylight value</td></tr>
<tr><td>nextEvent</td><td>the name of the next event</td></tr>
<tr><td>nextEventTime</td><td>the time when the next event will probably happen (during light phase 5 and 6 this is updated when weather conditions change</td></tr>
<tr><td>sr_astro</td><td>time of astronomical sunrise</td></tr>
<tr><td>sr_naut</td><td>time of nautical sunrise</td></tr>
<tr><td>sr_civil</td><td>time of civil sunrise</td></tr>
<tr><td>sr</td><td>time of sunrise</td></tr>
<tr><td>sr_indoor</td><td>time of indoor sunrise</td></tr>
<tr><td>sr_weather</td><td>time of weather sunrise</td></tr>
<tr><td>ss_weather</td><td>time of weather sunset</td></tr>
<tr><td>ss_indoor</td><td>time of indoor sunset</td></tr>
<tr><td>ss</td><td>time of sunset</td></tr>
<tr><td>ss_civil</td><td>time of civil sunset</td></tr>
<tr><td>ss_nautic</td><td>time of nautic sunset</td></tr>
<tr><td>ss_astro</td><td>time of astro sunset</td></tr>
<tr><td>azimuth</td><td>the current azimuth of the sun 0&deg; ist north 180&deg; is south</td></tr>
<tr><td>compasspoint</td><td>a textual representation of the compass point</td></tr>
<tr><td>elevation</td><td>the elevaltion of the sun</td></tr>
<tr><td>twilight</td><td>a percetal value of a new (twi)light value: (elevation+12)/18 * 100) </td></tr>
<tr><td>twilight_weather</td><td>a percetal value of a new (twi)light value: (elevation-WEATHER_HORIZON+12)/18 * 100). So if there is weather, it
<tr><td><b>light</b></td><td>the current virtual daylight value</td></tr>
<tr><td><b>nextEvent</b></td><td>the name of the next event</td></tr>
<tr><td><b>nextEventTime</b></td><td>the time when the next event will probably happen (during light phase 5 and 6 this is updated when weather conditions change</td></tr>
<tr><td><b>sr_astro</b></td><td>time of astronomical sunrise</td></tr>
<tr><td><b>sr_naut</b></td><td>time of nautical sunrise</td></tr>
<tr><td><b>sr_civil</b></td><td>time of civil sunrise</td></tr>
<tr><td><b>sr</b></td><td>time of sunrise</td></tr>
<tr><td><b>sr_indoor</b></td><td>time of indoor sunrise</td></tr>
<tr><td><b>sr_weather</b></td><td>time of weather sunrise</td></tr>
<tr><td><b>ss_weather</b></td><td>time of weather sunset</td></tr>
<tr><td><b>ss_indoor</b></td><td>time of indoor sunset</td></tr>
<tr><td><b>ss</b></td><td>time of sunset</td></tr>
<tr><td><b>ss_civil</b></td><td>time of civil sunset</td></tr>
<tr><td><b>ss_nautic</b></td><td>time of nautic sunset</td></tr>
<tr><td><b>ss_astro</b></td><td>time of astro sunset</td></tr>
<tr><td><b>azimuth</b></td><td>the current azimuth of the sun 0&deg; ist north 180&deg; is south</td></tr>
<tr><td><b>compasspoint</b></td><td>a textual representation of the compass point</td></tr>
<tr><td><b>elevation</b></td><td>the elevaltion of the sun</td></tr>
<tr><td><b>twilight</b></td><td>a percetal value of a new (twi)light value: (elevation+12)/18 * 100) </td></tr>
<tr><td><b>twilight_weather</b></td><td>a percetal value of a new (twi)light value: (elevation-WEATHER_HORIZON+12)/18 * 100). So if there is weather, it
is always a little bit darker than by fair weather</td></tr>
<tr><td>condition</td><td>the yahoo condition weather code</td></tr>
<tr><td>condition_txt</td><td>the yahoo condition weather code as textual representation</td></tr>
<tr><td>horizon</td><td>value auf the actual horizon 0&deg;, -6&deg;, -12&deg;, -18&deg;</td></tr>
<tr><td><b>condition</b></td><td>the yahoo condition weather code</td></tr>
<tr><td><b>condition_txt</b></td><td>the yahoo condition weather code as textual representation</td></tr>
<tr><td><b>horizon</b></td><td>value auf the actual horizon 0&deg;, -6&deg;, -12&deg;, -18&deg;</td></tr>
</table>
</ul>
@ -698,6 +709,20 @@ sub Twilight_CompassPoint($) {
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>
<br>
<a name="Twilightfunc"></a>
<b>Functions</b>
<ul>
<li><b>twilight</b>(<b>$twilight</b>, <b>$reading</b>, <b>$min</b>, <b>$max</b>)</li> - implements a routine to compute the twilighttimes like sunrise with min max values.<br><br>
<table>
<tr><td><b>$twilight</b></td><td>name of the twilight instance</td></tr>
<tr><td><b>$reading</b></td><td>name of the reading to use example: ss_astro, ss_weather ...</td></tr>
<tr><td><b>$min</b></td><td>parameter min time - optional</td></tr>
<tr><td><b>$max</b></td><td>parameter max time - optional</td></tr>
</table>
</ul>
<br>
</ul>
=end html

View File

@ -103,7 +103,7 @@ sub Heating_Control_Define($$)
# test if device is defined
return "invalid Device, given Device <$device> not found" if(!$defs{$device});
#Altlasten bereinigen
#fuer den modify Altlasten bereinigen
delete($hash->{TIME_AS_PERL}) if($hash->{TIME_AS_PERL});
delete($hash->{helper}{CONDITION}) if($hash->{helper}{CONDITION});
delete($hash->{helper}{COMMAND}) if($hash->{helper}{COMMAND});
@ -641,6 +641,12 @@ sub SortNumber {
<code>define HCW Heating_Control WZ_Heizung en Mo-Fr|{myFunction}|night-temp:18 Mo-Fr|{myFunction()}|dayTemp:16</code><br>
The is switched at time myFunction(). It is sent the Command "night-temp 18" and "dayTemp 16".
If you want to have set all Heating_Controls their current value (after a temperature lowering phase holidays)
you can call the function <b> Heating_Control_SetAllTemps ()</b>.
This call can be automatically coupled to a dummy by notify:       
<code>define HeizStatus2 notify Heating:. * {Heating_Control_SetAllTemps ()}</code>
</ul>
</ul>
@ -745,6 +751,12 @@ sub SortNumber {
<code>define HCW Heating_Control WZ_Heizung en Mo-Fr|{myFunction}|night-temp:18 Mo-Fr|{myFunction()}|dayTemp:16</code><br>
Das Gerät wird bei myFunction() geschaltet. Es wird das Kommando "night-temp 18" bzw. "dayTemp 16" gesendet.
Wenn du beispielsweise nach einer Temperaturabsenkungsphase erreichen willst, dass alle Heating_Controls ihren aktuellen Wert
einstellen sollen, kannst du die Funktion <b>Heating_Control_SetAllTemps()</b> aufrufen.
Dieser Aufruf kann per notify automatisch an ein dummy gekoppelt werden:
<code>define HeizStatus2 notify Heizung:.* {Heating_Control_SetAllTemps()}</code>
<p>
</ul>
</ul>

View File

@ -475,13 +475,15 @@ sub RandomTimer_disable($) {
<ul>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
<li><a name="disableCond">disableCond</a><br>
In the disableCond-Attibute a condition can be specified, that must be true to have the
Randomtimer work. The Condition must be put into round brackets. The best way is to define
The default behavior of a RandomTimer is, that it works.
To set the Randomtimer out of work, you can specify in the disableCond attibute a condition in perlcode that must evaluate to true.
The Condition must be put into round brackets. The best way is to define
a function in 99_utils.
<br>
<b>Examples</b>
<pre>
attr ZufallsTimerZ disableCond (!isVerreist())
attr ZufallsTimerZ disableCond (Value("presenceDummy" eq "notPresent"))
</pre>
</li>
<li><a name="onOffCmd">onCmd, offCmd</a><br>

View File

@ -24,8 +24,7 @@ use warnings;
use IO::Socket;
use Time::HiRes qw(gettimeofday);
################################################################################
sub WOL_Initialize($)
{
sub WOL_Initialize($) {
my ($hash) = @_;
$hash->{SetFn} = "WOL_Set";
@ -35,10 +34,8 @@ sub WOL_Initialize($)
$readingFnAttributes;
}
################################################################################
sub WOL_Set($@)
{
sub WOL_Set($@) {
my ($hash, @a) = @_;
return "no set value specified" if(int(@a) < 2);
return "Unknown argument $a[1], choose one of on off refresh" if($a[1] eq "?");
@ -71,8 +68,7 @@ sub WOL_Set($@)
return undef;
}
################################################################################
sub WOL_Define($$)
{
sub WOL_Define($$) {
my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def);
@ -125,8 +121,7 @@ sub WOL_Undef($$) {
return undef;
}
################################################################################
sub WOL_UpdateReadings($)
{
sub WOL_UpdateReadings($) {
my ($hash) = @_;
$hash->{INTERVAL} = AttrVal($hash->{NAME}, "interval", 900);
@ -144,8 +139,7 @@ sub WOL_UpdateReadings($)
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "WOL_UpdateReadings", $hash, 0);
}
################################################################################
sub WOL_GetUpdate($)
{
sub WOL_GetUpdate($) {
my ($hash) = @_;
if ($hash->{STATE} eq "on") {
@ -157,8 +151,7 @@ sub WOL_GetUpdate($)
}
}
################################################################################
sub wake($)
{
sub wake($){
my ($hash) = @_;
my $name = $hash->{NAME};
my $mac = $hash->{MAC};

View File

@ -81,7 +81,7 @@ my ($hash) = @_;
return Heating_Control_Update($hash);
}
#
sub WeekdayTimer_SetAllTemps() { # {WeekdayTimer_SetAllTemps()}
sub WeekdayTimer_SetAllParms() { # {WeekdayTimer_SetAllParms()}
foreach my $hc ( sort keys %{$modules{WeekdayTimer}{defptr}} ) {
my $hash = $modules{WeekdayTimer}{defptr}{$hc};
@ -95,7 +95,7 @@ sub WeekdayTimer_SetAllTemps() { # {WeekdayTimer_SetAllTemps()}
WeekdayTimer_Update($hash);
Log3 undef, 3, "WeekdayTimer_Update() for $hash->{NAME} done!";
}
Log3 undef, 3, "WeekdayTimer_SetAllTemps() done!";
Log3 undef, 3, "WeekdayTimer_SetAllParms() done!";
}
1;
@ -166,6 +166,12 @@ sub WeekdayTimer_SetAllTemps() { # {WeekdayTimer_SetAllTemps()}
<code>define dimmer WeekdayTimer livingRoom Sa-Su,We|07:00|dim30% Sa-Su,We|21:00|dim90% (ReadingsVal("WeAreThere", "state", "no") eq "yes")</code><br>
The dimmer is only set to dimXX% if the dummy variable WeAreThere is "yes"(not a real live example).<p>
If you want to have set all WeekdayTimer their current value (after a phase of exception),
you can call the function <b> WeekdayTimer_SetAllParms ()</b>.
This call can be automatically coupled to a dummy by notify:       
<code>define WDStatus2 notify Dummy:. * {WeekdayTimer_SetAllParms ()}</code>
</ul>
</ul>