latitude/longitude patches ba RueBe

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@1073 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2011-10-16 07:55:20 +00:00
parent 7424a448e0
commit eff8297f02
4 changed files with 70 additions and 8 deletions

View File

@@ -20,8 +20,8 @@ sub sunrise_coord($$$);
sub SUNRISE_Initialize($); sub SUNRISE_Initialize($);
# See perldoc DateTime::Event::Sunrise for details # See perldoc DateTime::Event::Sunrise for details
my $long = "8.686"; my $long;
my $lat = "50.112"; my $lat;
my $tz = ""; # will be overwritten my $tz = ""; # will be overwritten
my $altit = "-6"; # Civil twilight my $altit = "-6"; # Civil twilight
my $RADEG = ( 180 / 3.1415926 ); my $RADEG = ( 180 / 3.1415926 );
@@ -50,6 +50,15 @@ sr($$$$$$)
my $needset = (!$rise || $daycheck) ? 1 : 0; my $needset = (!$rise || $daycheck) ? 1 : 0;
$seconds = 0 if(!$seconds); $seconds = 0 if(!$seconds);
############################
# If set in global, use longitude/latitude
# from global, otherwise set Frankfurt/Germany as
# default
$long = AttrVal("global", "longitude", "8.686");
$lat = AttrVal("global", "latitude", "50.112");
Log 5, "Compute sunrise/sunset for latitude $lat , longitude $long";
my $nt = time; my $nt = time;
my @lt = localtime($nt); my @lt = localtime($nt);
my $gmtoff = _calctz($nt,@lt); # in hour my $gmtoff = _calctz($nt,@lt); # in hour

View File

@@ -924,6 +924,13 @@ A line ending with \ will be concatenated with the next one, so long lines
This attribute is DEPRECATED, use <a href="#notify">notify</a>, with This attribute is DEPRECATED, use <a href="#notify">notify</a>, with
the INITIALIZED event to execute commands after initialization. the INITIALIZED event to execute commands after initialization.
</li><br> </li><br>
<a name="latitude"></a>
<li>latitude<br>
If set, this latitude is used to calculate sunset/sunrise<br>
Notation need to be in decimal format (for example Berlin = 52.666)
As default Frankfurt/Main, Germany (50.112) is used.
</li><br>
<a name="logfile"></a> <a name="logfile"></a>
<li>logfile<br> <li>logfile<br>
@@ -933,6 +940,13 @@ A line ending with \ will be concatenated with the next one, so long lines
see the <a href="#FileLog">FileLog</a> section. see the <a href="#FileLog">FileLog</a> section.
</li><br> </li><br>
<a name="longitude></a>
<li>longitude<br>
If set, this longitude is used to calculate sunset/sunrise<br>
Notation need to be in decimal format (for example Berlin = 13.400)
As default Frankfurt/Main, Germany (8.686) is used.
</li><br>
<a name="modpath"></a> <a name="modpath"></a>
<li>modpath<br> <li>modpath<br>
Specify the path to the modules directory <code>FHEM</code>. The path Specify the path to the modules directory <code>FHEM</code>. The path
@@ -3031,6 +3045,25 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="EnOceanset"></a> <a name="EnOceanset"></a>
<b>Set</b> <b>Set</b>
<ul> <ul>
<li>MD15 commands. Note: The command is not sent until the MD15
wakes up and sends a mesage, usually every 10 minutes.
<ul>
<li>actuator &lt;value&gt;<br>
Set the actuator to the specifed percent value (0-100)</li>
<li>desired-temp &lt;value&gt;<br>
Use the builtin PI regulator, and set the desired temperature to the
specified degree. The actual value will be taken from the temperature
reported by the MD15.</li>
<li>desired+actual &lt;value1&gt; &lt;value2&gt;<br>
Use the builtin PI regulator, and set the desired temperature to
&lt;value1&gt;. The actual value is supplied in &lt;value2&gt;</li>
<li>unattended<br>
Do not regulate the MD15.</li>
</ul></li>
<li>all other:
<ul>
<code>set switch1 &lt;value&gt;</code> <code>set switch1 &lt;value&gt;</code>
<br><br> <br><br>
where <code>value</code> is one of A0,AI,B0,BI,C0,CI,D0,DI, combinations of where <code>value</code> is one of A0,AI,B0,BI,C0,CI,D0,DI, combinations of
@@ -3055,6 +3088,9 @@ A line ending with \ will be concatenated with the next one, so long lines
attr eventMap BI:on B0:off<br> attr eventMap BI:on B0:off<br>
set switch1 on<br> set switch1 on<br>
</code></ul> </code></ul>
</li>
</ul>
</ul> </ul>
<br> <br>
@@ -3118,11 +3154,28 @@ A line ending with \ will be concatenated with the next one, so long lines
<ul> <ul>
<li>temperature: XY.Z <li>temperature: XY.Z
<li>set_point: [0..255] <li>set_point: [0..255]
<li>fan: [0,1,2,3,Auto] <li>fan: [0|1|2|3|Auto]
<li>present: yes <li>present: yes
<li>learnBtn: on <li>learnBtn: on
<li>T: XY.Z SP: [0..255] F: [0,1,2,3,Auto] P: [yes|no] <li>T: XY.Z SP: [0..255] F: [0|1|2|3|Auto] P: [yes|no]
</ul> </ul>
<li>MD15-FtL-HE (Heating/Valve-regulator)<br>
subType must be MD15. This is done if the device was created by
autocreate.<br>
<ul>
<li>$actuator %
<li>currentValue: $actuator
<li>serviceOn: [yes|no]
<li>energyInput: [enabled|disabled]
<li>energyStorage: [charged|empty]
<li>battery: [ok|empty]
<li>cover: [open|closed]
<li>tempSensor: [failed|ok]
<li>window: [open|closed]
<li>actuator: [ok|obstructed]
<li>temperature: $tmp
</ul>
</ul> </ul>
</ul> </ul>

View File

@@ -327,8 +327,8 @@ by fhem.pl?</h4>
<ul> <ul>
Look for the geographic coordinates of your home, e.g with a GPS Look for the geographic coordinates of your home, e.g with a GPS
receiver or with googleearth. Compute the latitude/longitude as needed, and receiver or with googleearth. Compute the latitude/longitude as needed, and
enter them in your 99_SUNRISE_EL.pm file. set the latitude/longitude global attributes.
After restart, { sunrise() } will return the time of the next sunrise, { sunrise() } now will return the time of the next sunrise,
in a HH:MM:SS format. Also note <a href="#faq20">faq20</a><br><br> in a HH:MM:SS format. Also note <a href="#faq20">faq20</a><br><br>
Note: 99_SUNRISE_EL.pm is the ExtraLight version of the original Note: 99_SUNRISE_EL.pm is the ExtraLight version of the original

View File

@@ -167,7 +167,7 @@ my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0; my $intAtCnt=0;
my %duplicate; # Pool of received msg for multi-fhz/cul setups my %duplicate; # Pool of received msg for multi-fhz/cul setups
my $duplidx=0; # helper for the above pool my $duplidx=0; # helper for the above pool
my $cvsid = '$Id: fhem.pl,v 1.154 2011-10-02 12:27:51 rudolfkoenig Exp $'; my $cvsid = '$Id: fhem.pl,v 1.155 2011-10-16 07:55:20 rudolfkoenig Exp $';
my $namedef = my $namedef =
"where <name> is either:\n" . "where <name> is either:\n" .
"- a single device name\n" . "- a single device name\n" .
@@ -185,7 +185,7 @@ $modules{Global}{AttrList} =
"archivecmd allowfrom archivedir configfile lastinclude logfile " . "archivecmd allowfrom archivedir configfile lastinclude logfile " .
"modpath nrarchive pidfilename port statefile title userattr " . "modpath nrarchive pidfilename port statefile title userattr " .
"verbose:1,2,3,4,5 mseclog version nofork logdir holiday2we " . "verbose:1,2,3,4,5 mseclog version nofork logdir holiday2we " .
"autoload_undefined_devices dupTimeout"; "autoload_undefined_devices dupTimeout latitude longitude";
$modules{Global}{AttrFn} = "GlobalAttr"; $modules{Global}{AttrFn} = "GlobalAttr";
my $commonAttr = "eventMap"; my $commonAttr = "eventMap";