mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 17:26: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:
parent
7d34fbdfcf
commit
347565ca8d
@ -486,3 +486,6 @@
|
|||||||
- bugfix: deleting at definition in the at command
|
- bugfix: deleting at definition in the at command
|
||||||
- bugfix: deleting a notify/at/watchdog definition in a notify/at/watchdog
|
- 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: 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
|
||||||
|
@ -43,6 +43,14 @@ CUL_Initialize($)
|
|||||||
$hash->{ReadFn} = "CUL_Read";
|
$hash->{ReadFn} = "CUL_Read";
|
||||||
$hash->{WriteFn} = "CUL_Write";
|
$hash->{WriteFn} = "CUL_Write";
|
||||||
$hash->{Clients} = ":FS20:FHT:KS300:CUL_EM:CUL_WS:";
|
$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";
|
$hash->{ReadyFn} = "CUL_Ready";
|
||||||
|
|
||||||
# Normal devices
|
# Normal devices
|
||||||
@ -574,14 +582,13 @@ CUL_Read($)
|
|||||||
} elsif($fn eq "E") { # CUL_EM / Native
|
} elsif($fn eq "E") { # CUL_EM / Native
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
#Log GetLogLevel($name,4), "CUL: unknown message $dmsg";
|
Log GetLogLevel($name,4), "CUL: unknown message $dmsg";
|
||||||
goto NEXTMSG;
|
goto NEXTMSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash->{RSSI} = $rssi;
|
$hash->{RSSI} = $rssi;
|
||||||
my @found = Dispatch($hash, $dmsg);
|
my $foundp = Dispatch($hash, $dmsg);
|
||||||
if($rssi) {
|
if($foundp && $rssi) {
|
||||||
foreach my $d (@found) {
|
foreach my $d (@{$foundp}) {
|
||||||
next if(!$defs{$d});
|
next if(!$defs{$d});
|
||||||
$defs{$d}{RSSI} = $rssi;
|
$defs{$d}{RSSI} = $rssi;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ my %sets = (
|
|||||||
"initFS20" => "04 c90196",
|
"initFS20" => "04 c90196",
|
||||||
"FHTcode" => "04 c901839e0101",
|
"FHTcode" => "04 c901839e0101",
|
||||||
|
|
||||||
"activefor"=> "xx xx",
|
|
||||||
"raw" => "xx xx",
|
"raw" => "xx xx",
|
||||||
"initfull" => "xx xx",
|
"initfull" => "xx xx",
|
||||||
"reopen" => "xx xx",
|
"reopen" => "xx xx",
|
||||||
@ -39,7 +38,6 @@ my %setnrparam = (
|
|||||||
"initHMS" => 0,
|
"initHMS" => 0,
|
||||||
"initFS20" => 0,
|
"initFS20" => 0,
|
||||||
"FHTcode" => 1,
|
"FHTcode" => 1,
|
||||||
"activefor"=> 1,
|
|
||||||
"raw" => 2,
|
"raw" => 2,
|
||||||
"initfull" => 0,
|
"initfull" => 0,
|
||||||
"reopen" => 0,
|
"reopen" => 0,
|
||||||
@ -56,11 +54,17 @@ FHZ_Initialize($)
|
|||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
|
|
||||||
# Provider
|
# Provider
|
||||||
$hash->{ReadFn} = "FHZ_Read";
|
$hash->{ReadFn} = "FHZ_Read";
|
||||||
$hash->{WriteFn} = "FHZ_Write";
|
$hash->{WriteFn} = "FHZ_Write";
|
||||||
$hash->{Clients} = ":FHZ:FS20:FHT:HMS:KS300:";
|
$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";
|
$hash->{ReadyFn} = "FHZ_Ready";
|
||||||
|
|
||||||
# Consumer
|
# Consumer
|
||||||
@ -77,6 +81,7 @@ FHZ_Initialize($)
|
|||||||
"showtime:1,0 model:fhz1000,fhz1300 loglevel:0,1,2,3,4,5,6 ".
|
"showtime:1,0 model:fhz1000,fhz1300 loglevel:0,1,2,3,4,5,6 ".
|
||||||
"fhtsoftbuffer:1,0";
|
"fhtsoftbuffer:1,0";
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
FHZ_Ready($)
|
FHZ_Ready($)
|
||||||
@ -137,18 +142,7 @@ FHZ_Set($@)
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
Log GetLogLevel($name,2), "FHZ set $v";
|
Log GetLogLevel($name,2), "FHZ set $v";
|
||||||
|
|
||||||
if($a[1] eq "activefor") {
|
if($a[1] eq "initfull") {
|
||||||
|
|
||||||
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") {
|
|
||||||
|
|
||||||
my @init;
|
my @init;
|
||||||
push(@init, "get $name init2");
|
push(@init, "get $name init2");
|
||||||
@ -674,9 +668,7 @@ FHZ_Read($)
|
|||||||
$fhzdata = substr($fhzdata, 2);
|
$fhzdata = substr($fhzdata, 2);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my @found = Dispatch($hash, $dmsg);
|
Dispatch($hash, $dmsg);
|
||||||
|
|
||||||
NEXTMSG:
|
|
||||||
$fhzdata = substr($fhzdata, $len);
|
$fhzdata = substr($fhzdata, $len);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
11
fhem/TODO
Normal file
11
fhem/TODO
Normal 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
|
44
fhem/fhem.pl
44
fhem/fhem.pl
@ -45,7 +45,6 @@ sub AnalyzeInput($);
|
|||||||
sub AssignIoPort($);
|
sub AssignIoPort($);
|
||||||
sub CallFn(@);
|
sub CallFn(@);
|
||||||
sub CommandChain($$);
|
sub CommandChain($$);
|
||||||
sub CollectAttrNames();
|
|
||||||
sub DoClose($);
|
sub DoClose($);
|
||||||
sub Dispatch($$);
|
sub Dispatch($$);
|
||||||
sub FmtDateTime($);
|
sub FmtDateTime($);
|
||||||
@ -136,7 +135,6 @@ use vars qw(%cmds); # Global command name hash. To be expanded
|
|||||||
|
|
||||||
use vars qw($reread_active);
|
use vars qw($reread_active);
|
||||||
|
|
||||||
my %attrnames; # hash of attrnames needed by devspec2array
|
|
||||||
my $server; # Server socket
|
my $server; # Server socket
|
||||||
my $currlogfile; # logfile, without wildcards
|
my $currlogfile; # logfile, without wildcards
|
||||||
my $logopened = 0; # logfile opened or using stdout
|
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 $nextat; # Time when next timer will be triggered.
|
||||||
my $intAtCnt=0;
|
my $intAtCnt=0;
|
||||||
my $AttrList = "room comment";
|
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 =
|
my $namedef =
|
||||||
"where <name> is either:\n" .
|
"where <name> is either:\n" .
|
||||||
"- a single device name\n" .
|
"- a single device name\n" .
|
||||||
@ -219,7 +217,6 @@ $modules{_internal_}{AttrFn} = "GlobalAttr";
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# Start the program
|
# Start the program
|
||||||
if(int(@ARGV) != 1 && int(@ARGV) != 2) {
|
if(int(@ARGV) != 1 && int(@ARGV) != 2) {
|
||||||
@ -276,7 +273,6 @@ if($pfn) {
|
|||||||
print PID $$ . "\n";
|
print PID $$ . "\n";
|
||||||
close(PID);
|
close(PID);
|
||||||
}
|
}
|
||||||
CollectAttrNames();
|
|
||||||
$init_done = 1;
|
$init_done = 1;
|
||||||
|
|
||||||
Log 0, "Server started (version $attr{global}{version}, pid $$)";
|
Log 0, "Server started (version $attr{global}{version}, pid $$)";
|
||||||
@ -614,7 +610,7 @@ devspec2array($)
|
|||||||
push @ret, $l
|
push @ret, $l
|
||||||
if($defs{$l}{$lattr} && (!$re || $defs{$l}{$lattr} =~ m/$re/));
|
if($defs{$l}{$lattr} && (!$re || $defs{$l}{$lattr} =~ m/$re/));
|
||||||
}
|
}
|
||||||
} elsif($attrnames{$lattr}) {
|
} else {
|
||||||
foreach my $l (sort keys %attr) {
|
foreach my $l (sort keys %attr) {
|
||||||
push @ret, $l
|
push @ret, $l
|
||||||
if($attr{$l}{$lattr} && (!$re || $attr{$l}{$lattr} =~ m/$re/));
|
if($attr{$l}{$lattr} && (!$re || $attr{$l}{$lattr} =~ m/$re/));
|
||||||
@ -1140,7 +1136,6 @@ CommandDeleteAttr($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
CollectAttrNames();
|
|
||||||
|
|
||||||
return join("\n", @rets);
|
return join("\n", @rets);
|
||||||
}
|
}
|
||||||
@ -1449,7 +1444,6 @@ CommandAttr($$)
|
|||||||
$defs{$sdev}{IODev} = $defs{$a[2]} if($a[1] eq "IODev");
|
$defs{$sdev}{IODev} = $defs{$a[2]} if($a[1] eq "IODev");
|
||||||
|
|
||||||
}
|
}
|
||||||
CollectAttrNames() if($init_done);
|
|
||||||
return join("\n", @rets);
|
return join("\n", @rets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1469,7 +1463,6 @@ CommandDefaultAttr($$)
|
|||||||
} else {
|
} else {
|
||||||
$defaultattr{$a[0]} = $a[1];
|
$defaultattr{$a[0]} = $a[1];
|
||||||
}
|
}
|
||||||
CollectAttrNames() if($init_done);
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2017,11 +2010,23 @@ Dispatch($$)
|
|||||||
last if(int(@found));
|
last if(int(@found));
|
||||||
}
|
}
|
||||||
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!";
|
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) {
|
foreach my $found (@found) {
|
||||||
if($found =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
|
if($found =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
|
||||||
@ -2031,24 +2036,11 @@ Dispatch($$)
|
|||||||
$defs{$d}{TYPE} = $last_module;
|
$defs{$d}{TYPE} = $last_module;
|
||||||
DoTrigger($d, "$2 $3");
|
DoTrigger($d, "$2 $3");
|
||||||
CommandDelete(undef, $d); # Remove the device
|
CommandDelete(undef, $d); # Remove the device
|
||||||
goto NEXTMSG;
|
return undef;
|
||||||
} else {
|
} else {
|
||||||
DoTrigger($found, undef);
|
DoTrigger($found, undef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return @found;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user