mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 03:44:52 +00:00
- 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. git-svn-id: https://svn.fhem.de/fhem/trunk@11 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d5b8a2e8f6
commit
e416ae53af
@ -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 +{<number>}
|
||||
- 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
|
||||
|
@ -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]});
|
||||
|
@ -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.
|
||||
|
@ -228,6 +228,11 @@ split in multiple lines<br><br>
|
||||
(<code>fht80b, fs20du, fs20led, fs20piri, fs20s20, fs20s4a,
|
||||
fs20st fs20ts, hms100mg, rm100-2uni-s,</code> etc.).
|
||||
</li>
|
||||
<li>showtime<br>
|
||||
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.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
Examples:
|
||||
@ -246,7 +251,37 @@ split in multiple lines<br><br>
|
||||
Notes:<br>
|
||||
<ul>
|
||||
<li>There is no way to delete a single attribute.</li>
|
||||
</ul> </ul>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<a name="defattr"></a>
|
||||
<h3>defattr</h3>
|
||||
<ul>
|
||||
<code>defattr [<attrname> [<value>]] </code><br>
|
||||
|
||||
<br>Set the default attribute. Each device defined from now on will receive
|
||||
this attribute (see the <a href="#at">at</a> for details on attribute names
|
||||
and values).<br>
|
||||
If no attrname is specified, then the default attribute list will be deleted.
|
||||
<br><br>
|
||||
|
||||
Example to set the attribute "room kitchen" and "loglevel 4" to
|
||||
each of the lamps:
|
||||
<ul>
|
||||
<code>defattr room kitchen</code><br>
|
||||
<code>defattr loglevel 4</code><br>
|
||||
<code>define lamp1 FS20 1234 11</code><br>
|
||||
<code>define lamp2 FS20 1234 12</code><br>
|
||||
<code>define lamp3 FS20 1234 13</code><br>
|
||||
<code>defattr</code><br>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
Notes:<br>
|
||||
<ul>
|
||||
<li>There is no way to delete a single default-attribute from the list</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
29
fhem/fhem.pl
29
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=>"<timespec> <command>,issue a command at a given time" },
|
||||
"attr" => { Fn=>"CommandAttr",
|
||||
Hlp=>"<devname> <attrname> <attrvalue>,set attributes for <devname>" },
|
||||
"defattr" => { Fn=>"CommandDefAttr",
|
||||
Hlp=>"<attrname> <attrvalue>,set attr for following definitions" },
|
||||
"define" => { Fn=>"CommandDefine",
|
||||
Hlp=>"<name> <type> <options>,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($$)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user