mirror of
https://github.com/fhem/fhem-mirror.git
synced 2024-11-22 09:49:50 +00:00
Holiday bugfixes
git-svn-id: https://svn.fhem.de/fhem/trunk@376 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6378cd642b
commit
466d8cec52
@ -489,10 +489,12 @@
|
||||
- feature: Common Module calling for CUL/FHZ/CM11
|
||||
- feature: Store CUL sensitivity info
|
||||
- feature: avoid the "unknown/help me" message for unloaded devices
|
||||
- feature: structure module for big installations
|
||||
- feature: structure module for large installations
|
||||
- feature: Cost Control in 15_CUL_EM (CostPerUnit, BasisFeePerMonth)
|
||||
- feature: add counter differential per time in 81_M232Counter.pm
|
||||
- feature: added USB compendium to documentation
|
||||
- feature: pgm3: Documentation for pgm3 updated, HMS100CO added (and bugfixes)
|
||||
- bugfix: Defining a repeated at job in a sunrise/sunset at job fails
|
||||
- bugfix: FHT "summer" fix (avoiding a lot of syncnow)
|
||||
- feature: FHEMWEB modules added
|
||||
- feature: holiday module + doc + example + holiday2we attribute
|
||||
|
@ -120,6 +120,46 @@ holiday_refresh($$)
|
||||
$found = $args[3];
|
||||
last;
|
||||
}
|
||||
|
||||
} elsif($l =~ m/^5/) { # nth weekday since MM-DD / before MM-DD
|
||||
my @a = split(" +", $l, 6);
|
||||
# arguments: 5 <distance> <weekday> <day> <month> <name>
|
||||
my %wd = ("Sun"=>0, "Mon"=>1, "Tue"=>2, "Wed"=>3,
|
||||
"Thu"=>4, "Fri"=>5, "Sat"=>6);
|
||||
my $wd = $wd{$a[2]};
|
||||
if(!defined($wd)) {
|
||||
Log 1, "Wrong weekday spec: $l";
|
||||
next;
|
||||
}
|
||||
next if $wd != $fd[6]; # check wether weekday matches today
|
||||
my $yday=$fd[7];
|
||||
# create time object of target date - mktime counts months and their
|
||||
# days from 0 instead of 1, so subtract 1 from each
|
||||
my $tgt=mktime(0,0,1,$a[3]-1,$a[4]-1,$fd[5],0,0,-1);
|
||||
my $tgtmin=$tgt;
|
||||
my $tgtmax=$tgt;
|
||||
my $weeksecs=7*24*60*60; # 7 days, 24 hours, 60 minutes, 60seconds each
|
||||
my $cd=mktime(0,0,1,$fd[3],$fd[4],$fd[5],0,0,-1);
|
||||
if ( $a[1] =~ /^-([0-9])*$/ ) {
|
||||
$tgtmin -= $1*$weeksecs; # Minimum: target date minus $1 weeks
|
||||
$tgtmax = $tgtmin+$weeksecs; # Maximum: one week after minimum
|
||||
# needs to be lower than max and greater than or equal to min
|
||||
if ( ($cd ge $tgtmin) && ( $cd lt $tgtmax) ) {
|
||||
$found=$a[5];
|
||||
last;
|
||||
}
|
||||
} elsif ( $a[1] =~ /^\+?([0-9])*$/ ) {
|
||||
$tgtmin += ($1-1)*$weeksecs; # Minimum: target date plus $1-1 weeks
|
||||
$tgtmax = $tgtmin+$weeksecs; # Maximum: one week after minimum
|
||||
# needs to be lower than or equal to max and greater min
|
||||
if ( ($cd gt $tgtmin) && ( $cd le $tgtmax) ) {
|
||||
$found=$a[5];
|
||||
last;
|
||||
}
|
||||
} else {
|
||||
Log 1, "Wrong distance spec: $l";
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -396,5 +396,3 @@
|
||||
- pgm3: bugfix, format table for userdef
|
||||
- pgm3: feature X10_support, taillogorder optional with date
|
||||
- pgm3: HMS100CO added, fhem.html relating pgm3 updated
|
||||
|
||||
|
||||
|
@ -33,7 +33,6 @@ install-base:
|
||||
mkdir -p $(BINDIR) $(MODDIR) $(VARDIR)
|
||||
cp fhem.pl $(BINDIR)
|
||||
cp -r FHEM $(MODDIR)
|
||||
mkdir -p $(VARDIR)
|
||||
perl -pi -e 's,modpath \.,modpath $(MODDIR),' examples/[a-z]*
|
||||
perl -pi -e 's,/tmp,$(VARDIR),' examples/[a-z]*
|
||||
|
||||
|
@ -4,6 +4,7 @@ FHEM:
|
||||
- holiday database
|
||||
- fhem-to-fhem module
|
||||
- CUR built-in MENU creation support
|
||||
- Remove or reimplement repeater attribute (cul/fhz/doc)
|
||||
|
||||
Webpgm2
|
||||
- plot data from multiple files in a single picture
|
||||
|
19
fhem/contrib/by.holiday
Normal file
19
fhem/contrib/by.holiday
Normal file
@ -0,0 +1,19 @@
|
||||
# Siehe auch
|
||||
# http://de.wikipedia.org/wiki/Feiertage_in_Deutschland
|
||||
|
||||
1 01-01 Neujahr
|
||||
1 01-06 Heilige Drei Koenige
|
||||
1 05-01 Tag der Arbeit
|
||||
1 08-15 Mariae Himmelfahrt (nur bei ueberwiegend katholischer Bevoelkerung)
|
||||
1 10-03 Tag der deutschen Einheit
|
||||
1 11-01 Allerheiligen
|
||||
1 12-25 1. Weihnachtstag
|
||||
1 12-26 2. Weihnachtstag
|
||||
|
||||
2 -2 Karfreitag
|
||||
2 1 Ostermontag
|
||||
2 39 Christi Himmelfahrt
|
||||
2 50 Pfingsten
|
||||
2 60 Fronleichnam
|
||||
#5 -1 Wed 11 23 Buss und Bettag (first Wednesday before Nov, 23rd)<br>
|
||||
|
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/perl
|
||||
die("Usage: checkmsg HEX-FHZ-MESSAGE\n") if(int(@ARGV) != 1);
|
||||
my $msg = $ARGV[0];
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
<a href="#log">Logging data</a><br/>
|
||||
<a href="#plot">Plotting logs</a><br/>
|
||||
<a href="#tips">FHEMWEB tips</a><br/>
|
||||
<a href="#structure">Complex structures</a><br/>
|
||||
|
||||
|
||||
<a name="starting"/>
|
||||
@ -233,7 +234,18 @@
|
||||
define messages FileLog /var/log/messages fakelog
|
||||
</pre>
|
||||
<br/><br/>
|
||||
</ul>
|
||||
|
||||
<a name="structure"/>
|
||||
<h3>Complex structures</h3>
|
||||
<ul>
|
||||
Put your devices in different rooms. You can now use the
|
||||
room=<roomname> specification to set different devices at once.
|
||||
See the <a href="commandref.html#devspec">devspec</a> paragraph for details.<br>
|
||||
For more complex scenarios consider the <a href="commandref.html#structure">
|
||||
structure</a> module. You can define different structure levels like
|
||||
floors, buildings, etc. and set all elements of a gives structure at once.
|
||||
</ul>
|
||||
|
||||
<body>
|
||||
</html>
|
||||
|
@ -2964,9 +2964,20 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
4 01-06 31-06 Summer holiday<br>
|
||||
</ul>
|
||||
</li>
|
||||
<li>5<br>
|
||||
Date relative, weekday fixed holiday. Arguments: <nth>
|
||||
<weekday> <month> <day> < holiday-name><br>
|
||||
Note that while +0 or -0 as offsets are not forbidden, their behaviour
|
||||
is undefined in the sense that it might change without notice.<br>
|
||||
Examples:<br>
|
||||
<ul>
|
||||
5 -1 Wed 11 23 Buss und Bettag (first Wednesday before Nov, 23rd)<br>
|
||||
5 1 Mon 01 31 First Monday after Jan, 31st (1st Monday in February)<br>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
See also he.holiday in the contrib directory for official holidays in the
|
||||
german country of Hessen.
|
||||
german country of Hessen, and by.holiday for the Bavarian definition.
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
|
@ -214,9 +214,8 @@ that 255 should be the default?</b>
|
||||
<b>8. The time specification of the builtin at command is not very
|
||||
flexible. Please add day/month/weekday to it.</b>
|
||||
<ul>
|
||||
I think the command is complex and flexible enough. Use a perl expression
|
||||
for this functionality like (described in the commandref.html):
|
||||
<pre>at *07:00:00 { fhz "set lamp on" if($we) }</pre>
|
||||
Please take a look at the holiday device, and the perl helper variables (both
|
||||
described in the commandref.html).
|
||||
</ul>
|
||||
|
||||
|
||||
@ -234,7 +233,8 @@ it.</b>
|
||||
by fhem.pl?</b>
|
||||
|
||||
<ul>
|
||||
Convert the first 2 digits first from decimal to hex, then the next two. Example:<br>
|
||||
Convert the first 2 digits first from decimal to hex, then the next two.
|
||||
Example:<br>
|
||||
<pre>
|
||||
% bc
|
||||
obase=16
|
||||
|
@ -52,8 +52,13 @@ Currently implemented features:<br>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Via the CUL module (see <a href="http://www.busware.de">www.busware.de
|
||||
</a>) access to the FS20/EM1000/FHT/S300 protocols. <b>Note:</b>due to
|
||||
the incomplete firmware the access is read-only at the moment.
|
||||
</a>) access to the following protocols:<br>
|
||||
<ul>
|
||||
<li>FS20 (Receive/Send, all devices)
|
||||
<li>EM (EM1000EM/EM1000GZ/EM1000WZ)
|
||||
<li>FHT (Only snoop functionality, no send!)
|
||||
<li>S300 (KS300, S300TH, S555TH, etc)
|
||||
/ul>
|
||||
</li>
|
||||
<li>reading WS300 data, and up to 9 attached devices</li>
|
||||
<li>reading EM1000WZ/EM1000EM/EM1000GZ data via an attached EM1010PC</li>
|
||||
@ -83,8 +88,8 @@ commandref.html</a> and <a href="faq.html">faq.html</a> for more documentation,
|
||||
http://www.koeniglich.de/fhem/fhem-=VERS=.tar.gz</a><br>
|
||||
FAQ: <a href="http://www.koeniglich.de/fhem/faq.html">
|
||||
http://www.koeniglich.de/fhem/faq.html</a><br>
|
||||
Google-Group: <a href="http://groups.google.com/group/FHZ1000-users-on-unix">
|
||||
http://groups.google.com/group/FHZ1000-users-on-unix</a><br>
|
||||
Google-Group: <a href="http://groups.google.com/group/fhem-users">
|
||||
http://groups.google.com/group/fhem-users</a><br>
|
||||
Martins Web frontend (webpgm3): <a href="http://www.martin-haas.de/fhz">
|
||||
http://www.martin-haas.de/fhz</a><br>
|
||||
Another Martins Web frontend (myHCE):
|
||||
|
@ -8,7 +8,7 @@ attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||
attr global port 7072 # our TCP/IP port (localhost only)
|
||||
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||
|
||||
define WEB FHEMWEB 8083
|
||||
define WEB FHEMWEB 8083 global
|
||||
attr WEB plotmode SVG
|
||||
|
||||
# Fake logfile, to access the global log
|
||||
|
13
fhem/fhem.pl
13
fhem/fhem.pl
@ -151,7 +151,7 @@ my %defaultattr; # Default attributes
|
||||
my %intAt; # Internal at timer hash.
|
||||
my $nextat; # Time when next timer will be triggered.
|
||||
my $intAtCnt=0;
|
||||
my $cvsid = '$Id: fhem.pl,v 1.70 2009-04-11 08:20:13 rudolfkoenig Exp $';
|
||||
my $cvsid = '$Id: fhem.pl,v 1.71 2009-05-23 07:32:08 rudolfkoenig Exp $';
|
||||
my $namedef =
|
||||
"where <name> is either:\n" .
|
||||
"- a single device name\n" .
|
||||
@ -167,7 +167,7 @@ $modules{_internal_}{LOADED} = 1;
|
||||
$modules{_internal_}{AttrList} =
|
||||
"archivecmd allowfrom archivedir configfile lastinclude logfile " .
|
||||
"modpath nrarchive pidfilename port statefile title userattr " .
|
||||
"verbose:1,2,3,4,5 mseclog version nofork logdir";
|
||||
"verbose:1,2,3,4,5 mseclog version nofork logdir holiday2we";
|
||||
$modules{_internal_}{AttrFn} = "GlobalAttr";
|
||||
|
||||
|
||||
@ -294,7 +294,8 @@ while (1) {
|
||||
}
|
||||
|
||||
my $timeout = HandleTimeout();
|
||||
$timeout = $readytimeout if(!defined($timeout) && keys %readyfnlist);
|
||||
$timeout = $readytimeout if(keys(%readyfnlist) &&
|
||||
(!defined($timeout) || $timeout > $readytimeout));
|
||||
my $nfound = select($rout=$rin, undef, undef, $timeout);
|
||||
|
||||
CommandShutdown(undef, undef) if($sig_term);
|
||||
@ -526,6 +527,10 @@ AnalyzeCommand($$)
|
||||
}
|
||||
my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime;
|
||||
my $we = (($wday==0 || $wday==6) ? 1 : 0);
|
||||
if(!$we) {
|
||||
my $h2we = $attr{global}{holiday2we};
|
||||
$we = 1 if($h2we && $value{$h2we} ne "none");
|
||||
}
|
||||
$month++;
|
||||
$year+=1900;
|
||||
|
||||
@ -839,7 +844,7 @@ CommandSave($$)
|
||||
print SFH "\n";
|
||||
|
||||
# then the "important" ones (FHZ, WS300Device)
|
||||
foreach my $d (sort keys %savefirst) {
|
||||
foreach my $d (sort { $defs{$a}{NR} <=> $defs{$b}{NR} } keys %savefirst) {
|
||||
my $r = $savefirst{$d};
|
||||
delete $rooms{$r}{$d};
|
||||
delete $rooms{$r} if(! %{$rooms{$r}});
|
||||
|
Loading…
Reference in New Issue
Block a user