2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 22:56:34 +00:00

Avoidinig "help me!" messages

git-svn-id: https://svn.fhem.de/fhem/trunk@342 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-01-27 08:01:35 +00:00
parent 7d34fbdfcf
commit 347565ca8d
5 changed files with 54 additions and 49 deletions

View File

@ -486,3 +486,6 @@
- bugfix: deleting at definition in the at command
- bugfix: deleting a notify/at/watchdog definition in a notify/at/watchdog
- feature: devspec <attr>=<value>. E.g. set room=kitchen off; list disabled=
- feature: Common Module calling for CUL/FHZ/CM11
- feature: Store CUL sensitivity info
- feature: avoid the "unknown/help me" message for unloaded devices

View File

@ -43,6 +43,14 @@ CUL_Initialize($)
$hash->{ReadFn} = "CUL_Read";
$hash->{WriteFn} = "CUL_Write";
$hash->{Clients} = ":FS20:FHT:KS300:CUL_EM:CUL_WS:";
my %mc = (
"1:FS20" => "^81..(04|0c)..0101a001",
"2:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
"3:KS300" => "^810d04..4027a001",
"4:CUL_WS" => "^K.....",
"5:CUL_EM" => "^E0.................\$"
);
$hash->{MatchList} = \%mc;
$hash->{ReadyFn} = "CUL_Ready";
# Normal devices
@ -574,14 +582,13 @@ CUL_Read($)
} elsif($fn eq "E") { # CUL_EM / Native
;
} else {
#Log GetLogLevel($name,4), "CUL: unknown message $dmsg";
Log GetLogLevel($name,4), "CUL: unknown message $dmsg";
goto NEXTMSG;
}
$hash->{RSSI} = $rssi;
my @found = Dispatch($hash, $dmsg);
if($rssi) {
foreach my $d (@found) {
my $foundp = Dispatch($hash, $dmsg);
if($foundp && $rssi) {
foreach my $d (@{$foundp}) {
next if(!$defs{$d});
$defs{$d}{RSSI} = $rssi;
}

View File

@ -29,7 +29,6 @@ my %sets = (
"initFS20" => "04 c90196",
"FHTcode" => "04 c901839e0101",
"activefor"=> "xx xx",
"raw" => "xx xx",
"initfull" => "xx xx",
"reopen" => "xx xx",
@ -39,7 +38,6 @@ my %setnrparam = (
"initHMS" => 0,
"initFS20" => 0,
"FHTcode" => 1,
"activefor"=> 1,
"raw" => 2,
"initfull" => 0,
"reopen" => 0,
@ -56,11 +54,17 @@ FHZ_Initialize($)
{
my ($hash) = @_;
# Provider
$hash->{ReadFn} = "FHZ_Read";
$hash->{WriteFn} = "FHZ_Write";
$hash->{Clients} = ":FHZ:FS20:FHT:HMS:KS300:";
my %mc = (
"1:FS20" => "^81..(04|0c)..0101a001",
"2:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
"3:HMS" => "^810e04....(1|5|9).a001",
"4:KS300" => "^810d04..4027a001"
);
$hash->{MatchList} = \%mc;
$hash->{ReadyFn} = "FHZ_Ready";
# Consumer
@ -77,6 +81,7 @@ FHZ_Initialize($)
"showtime:1,0 model:fhz1000,fhz1300 loglevel:0,1,2,3,4,5,6 ".
"fhtsoftbuffer:1,0";
}
#####################################
sub
FHZ_Ready($)
@ -137,18 +142,7 @@ FHZ_Set($@)
my $name = $hash->{NAME};
Log GetLogLevel($name,2), "FHZ set $v";
if($a[1] eq "activefor") {
my $dhash = $defs{$a[2]};
return "device $a[2] unknown" if(!defined($dhash));
return "Cannot handle $dhash->{TYPE} devices"
if($modules{FHZ}->{Clients} !~ m/:$dhash->{TYPE}:/);
$dhash->{IODev} = $hash;
return undef;
} elsif($a[1] eq "initfull") {
if($a[1] eq "initfull") {
my @init;
push(@init, "get $name init2");
@ -674,9 +668,7 @@ FHZ_Read($)
$fhzdata = substr($fhzdata, 2);
next;
}
my @found = Dispatch($hash, $dmsg);
NEXTMSG:
Dispatch($hash, $dmsg);
$fhzdata = substr($fhzdata, $len);
} else {

11
fhem/TODO Normal file
View File

@ -0,0 +1,11 @@
FHEM:
- Common buffer for parallel use of two devices: CUL+FHZ, (WS300/EM1000PC?)
- holiday database
- fhem-to-fhem module
- Remote serial device via IP
- CUR built-in MENU creation support
Webpgm2
- plot data from multiple files in a single picture
- setting the dummy state via dropdown is not possible
- SVG gimmicks for the plot

View File

@ -45,7 +45,6 @@ sub AnalyzeInput($);
sub AssignIoPort($);
sub CallFn(@);
sub CommandChain($$);
sub CollectAttrNames();
sub DoClose($);
sub Dispatch($$);
sub FmtDateTime($);
@ -136,7 +135,6 @@ use vars qw(%cmds); # Global command name hash. To be expanded
use vars qw($reread_active);
my %attrnames; # hash of attrnames needed by devspec2array
my $server; # Server socket
my $currlogfile; # logfile, without wildcards
my $logopened = 0; # logfile opened or using stdout
@ -151,7 +149,7 @@ my %intAt; # Internal at timer hash.
my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0;
my $AttrList = "room comment";
my $cvsid = '$Id: fhem.pl,v 1.67 2009-01-17 10:01:56 rudolfkoenig Exp $';
my $cvsid = '$Id: fhem.pl,v 1.68 2009-01-27 08:01:34 rudolfkoenig Exp $';
my $namedef =
"where <name> is either:\n" .
"- a single device name\n" .
@ -219,7 +217,6 @@ $modules{_internal_}{AttrFn} = "GlobalAttr";
);
###################################################
# Start the program
if(int(@ARGV) != 1 && int(@ARGV) != 2) {
@ -276,7 +273,6 @@ if($pfn) {
print PID $$ . "\n";
close(PID);
}
CollectAttrNames();
$init_done = 1;
Log 0, "Server started (version $attr{global}{version}, pid $$)";
@ -614,7 +610,7 @@ devspec2array($)
push @ret, $l
if($defs{$l}{$lattr} && (!$re || $defs{$l}{$lattr} =~ m/$re/));
}
} elsif($attrnames{$lattr}) {
} else {
foreach my $l (sort keys %attr) {
push @ret, $l
if($attr{$l}{$lattr} && (!$re || $attr{$l}{$lattr} =~ m/$re/));
@ -1140,7 +1136,6 @@ CommandDeleteAttr($$)
}
}
CollectAttrNames();
return join("\n", @rets);
}
@ -1449,7 +1444,6 @@ CommandAttr($$)
$defs{$sdev}{IODev} = $defs{$a[2]} if($a[1] eq "IODev");
}
CollectAttrNames() if($init_done);
return join("\n", @rets);
}
@ -1469,7 +1463,6 @@ CommandDefaultAttr($$)
} else {
$defaultattr{$a[0]} = $a[1];
}
CollectAttrNames() if($init_done);
return undef;
}
@ -2017,11 +2010,23 @@ Dispatch($$)
last if(int(@found));
}
if(!int(@found)) {
my $h = $iohash->{MatchList};
if(defined($h)) {
foreach my $m (sort keys %{$h}) {
if($dmsg =~ m/$h->{$m}/) {
my (undef, $mname) = split(":", $m);
Log GetLogLevel($name,3),
"$name: Unknown $mname device detected, " .
"define one to get detailed information.";
return undef;
}
}
}
Log GetLogLevel($name,3), "$name: Unknown code $dmsg, help me!";
return "";
return undef;
}
return if($found[0] eq ""); # Special return: Do not notify
return undef if($found[0] eq ""); # Special return: Do not notify
foreach my $found (@found) {
if($found =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
@ -2031,24 +2036,11 @@ Dispatch($$)
$defs{$d}{TYPE} = $last_module;
DoTrigger($d, "$2 $3");
CommandDelete(undef, $d); # Remove the device
goto NEXTMSG;
return undef;
} else {
DoTrigger($found, undef);
}
}
return @found;
}
###########################
# Build the hash used by devspec2array
sub
CollectAttrNames()
{
%attrnames = ();
foreach my $d (keys %attr) {
foreach my $a (keys %{ $attr{$d} }) {
$attrnames{$a} = 1;
}
}
return \@found;
}