diff --git a/fhem/CHANGED b/fhem/CHANGED index 13f5a5a67..eab703268 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -295,12 +295,14 @@ - feature: new FHT codes, e.g. month/day/hour/minute setting (by Holger) - ==DATE== (3.4) - - bugfix: deny at +{3}... (only +*{3} allowed), reported by Bernd, 25.02 + - bugfix: deny at +{3}... (only +*{3} allowed), reported by Bernd, 25.01 - bugfix: allow numbers greater then 9 in at +{} - - feature: new 50_WS300.pm from Martin (bugfix + rain statistics, 26.02) + - feature: new 50_WS300.pm from Martin (bugfix + rain statistics, 26.01) - feature: renamed fhz1000 to fhem - feature: added HISTORY and README.DEV - doc: Added description of attribute "model". - bugfix: delete the pidfile when terminating. (reported by Martin and Peter) - - TODO: feature: add direction to the logs + - feature: attribute showtime in web-pgm2 (show time instead of state) + - feature: defattr (default attribute for following defines) + - feature: added em1010.pl to the contrib directory - TODO: bugfix: more thorough serial line initialization diff --git a/fhem/FHEM/00_FHZ.pm b/fhem/FHEM/00_FHZ.pm index d6c8e6d8f..be0d449f6 100755 --- a/fhem/FHEM/00_FHZ.pm +++ b/fhem/FHEM/00_FHZ.pm @@ -35,7 +35,7 @@ my %setnrparam = ( "time" => 0, "initHMS" => 0, "initFS20" => 0, - "FHTcode" => 0, + "FHTcode" => 1, "activefor"=> 1, "raw" => 2, ); @@ -84,7 +84,7 @@ FHZ_Set($@) return "Need one to three parameter" if(@a > 4); return "invalid parameter, use one of:\n " . join("\n ", sort keys %sets) if(!defined($sets{$a[1]})); - return "Wrong number of parameters, need " . ($setnrparam{$a[1]} + 2) + return "Wrong number of parameters for $a[1], need " . ($setnrparam{$a[1]}+2) if(@a != ($setnrparam{$a[1]} + 2)); my ($fn, $arg) = split(" ", $sets{$a[1]}); diff --git a/fhem/HISTORY b/fhem/HISTORY index 61ca4f742..27f7b6390 100644 --- a/fhem/HISTORY +++ b/fhem/HISTORY @@ -3,3 +3,10 @@ - Pest, Thu Feb 1 20:45 MET 2007 Added description for attribute "model" in commandref.html + +- Rudi, Sun Feb 11 18:56:05 MET 2007 + - showtime added for pgm2 (useful for FS20 piri display) + - defattr command added, it makes easier to assign room, type, etc for a group + of devices. + - em1010.pl added to the contrib directory. It seems that we are able + to read out the EM1010PC. Not verified with multiple devices. diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index 6a0657c03..97448bc1f 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -228,6 +228,11 @@ split in multiple lines

(fht80b, fs20du, fs20led, fs20piri, fs20s20, fs20s4a, fs20st fs20ts, hms100mg, rm100-2uni-s, etc.). +
  • showtime
    + Used in the webfrontend pgm2 to show the time of last activity + instead of the state in the summary view. Useful e.g. for FS20 PIRI + devices. +
  • Examples: @@ -246,7 +251,37 @@ split in multiple lines

    Notes:
    + + + + +

    defattr

    + diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 79ab9b64b..64454655d 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -63,6 +63,7 @@ sub XmlEscape($); sub CommandAt($$); sub CommandAttr($$); +sub CommandDefAttr($$); sub CommandDefine($$); sub CommandDelete($$); sub CommandFhzDev($$); @@ -115,6 +116,7 @@ my $sig_term = 0; # if set to 1, terminate (saving the state) my $modpath_set; # Check if modpath was used, and report if not. my $global_cl; # To use from perl snippets my $devcount = 0; # To sort the devices +my %defattr; # Default attributes my %intAt; # Internal at timer hash. my $intAtCnt=0; my $init_done = 0; @@ -128,6 +130,8 @@ my %cmds = ( Hlp=>" ,issue a command at a given time" }, "attr" => { Fn=>"CommandAttr", Hlp=>" ,set attributes for " }, + "defattr" => { Fn=>"CommandDefAttr", + Hlp=>" ,set attr for following definitions" }, "define" => { Fn=>"CommandDefine", Hlp=>" ,define a code" }, "delete" => { Fn=>"CommandDelete", @@ -863,7 +867,6 @@ CommandAt($$) $rel = "" if(!defined($rel)); $rep = "" if(!defined($rep)); $cnt = "" if(!defined($cnt)); - Log 1, "$rel, $rep, $cnt, $tspec"; my $ot = time; my @lt = localtime($ot); @@ -929,7 +932,13 @@ CommandDefine($$) no strict "refs"; $ret = &{$fnname}(\%hash, @a); use strict "refs"; - delete $ghash->{$a[0]} if($ret); + if($ret) { + delete $ghash->{$a[0]} + } else { + foreach my $da (sort keys (%defattr)) { # Default attributes + CommandAttr($cl, "$a[0] $da $defattr{$da}"); + } + } return $ret; } @@ -1336,6 +1345,22 @@ CommandAttr($$) return undef; } +sub +CommandDefAttr($$) +{ + my ($cl, $param) = @_; + + my @a = split(" ", $param, 2); + if(int(@a) == 0) { + %defattr = (); + } elsif(int(@a) == 1) { + $defattr{$a[0]} = 1; + } else { + $defattr{$a[0]} = $a[1]; + } + return undef; +} + ##################################### sub CommandSetstate($$) diff --git a/fhem/test/fhem.save b/fhem/test/fhem.save index accd0f14e..da5802054 100644 --- a/fhem/test/fhem.save +++ b/fhem/test/fhem.save @@ -1,4 +1,4 @@ -#Mon Jan 8 10:37:18 2007 +#Thu Feb 8 15:09:20 2007 setstate FHZ fhtbuf: 1c setstate FHZ 2006-02-12 14:03:39 fhtbuf 23 setstate FHZ 2006-03-26 08:47:36 init2 deadbeefdeadbe @@ -33,18 +33,13 @@ setstate fl 2006-03-26 08:50:55 windowopen-temp 12.0 (Celsius) setstate fl 2006-03-29 23:04:27 measured-temp 21.6 (Celsius) setstate floor-lamp on setstate floor-lamp 2006-03-29 12:05:34 on -setstate ks1 T: 26.5 H: 24 W: 0.0 R: 12.1 -setstate ks1 2006-05-11 17:41:11 wind 0.0 (km/h) -setstate ks1 2006-05-11 17:41:11 rain 12.1 (l/m2) -setstate ks1 2006-05-11 17:41:11 temperature 26.5 (Celsius) -setstate ks1 2006-05-11 17:41:11 humidity 24 (%) setstate marqee on setstate marqee 2006-04-01 12:46:02 on setstate tf1 T: 20.3 H: 31.3 Bat: ok setstate tf1 2006-04-11 09:48:48 battery Bat: ok setstate tf1 2006-04-11 09:48:48 type HMS100TF -setstate tf1 2006-04-11 09:48:48 temperature 20.3 (Celsius) setstate tf1 2006-04-11 09:48:48 humidity 31.3 (%) +setstate tf1 2006-04-11 09:48:48 temperature 20.3 (Celsius) setstate window-lamp on setstate window-lamp 2006-03-29 12:05:34 on setstate wz measured-temp: 22.4 (Celsius)