mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
IODev attribute added
git-svn-id: https://svn.fhem.de/fhem/trunk@315 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0a3aa137ce
commit
df50881fc7
@ -475,4 +475,5 @@
|
||||
- feature: 00_CUL: Answer CUR requests (status/time/fht)
|
||||
- bugfix: support for second correction factor for EMWZ in 15_CUL_EM added
|
||||
- feature: CUL further sets/gets added
|
||||
- feature: Removed msghist for multiple FHZ handling, IODev attribute added
|
||||
- bugfix: cut off string "(counter)" from fallback value in 13_KS300.pm
|
||||
|
@ -78,10 +78,6 @@ my %sets = (
|
||||
"test" => "xxx",
|
||||
);
|
||||
|
||||
my $def;
|
||||
my %msghist; # Used when more than one CUL is attached
|
||||
my $msgcount = 0;
|
||||
|
||||
|
||||
#####################################
|
||||
|
||||
@ -413,61 +409,6 @@ CM11_SetInterfaceTime($)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#####################################
|
||||
sub
|
||||
CM11_Dispatch($$$$)
|
||||
{
|
||||
my ($hash,$housecode,$unitcodes,$x10func)= @_;
|
||||
|
||||
my $prefix= "CM11 device " . $hash->{NAME} . ":";
|
||||
my $iohash = $modules{$hash->{TYPE}}; # Our (CM11) module pointer
|
||||
|
||||
$unitcodes= "" unless(defined($unitcodes));
|
||||
my $dmsg= "X10:$housecode;$unitcodes;$x10func";
|
||||
Log 5, "$prefix dispatch $dmsg";
|
||||
|
||||
my @found;
|
||||
my $last_module;
|
||||
my $nfound;
|
||||
foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} }
|
||||
grep {defined($modules{$_}{ORDER});}keys %modules) {
|
||||
next if($iohash->{Clients} !~ m/:$m:/);
|
||||
|
||||
# Module is not loaded or the message is not for this module
|
||||
next if(!$modules{$m}{Match} || $dmsg !~ m/$modules{$m}{Match}/i);
|
||||
|
||||
no strict "refs";
|
||||
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
|
||||
use strict "refs";
|
||||
$last_module = $m;
|
||||
$nfound= int(@found);
|
||||
last if($nfound);
|
||||
}
|
||||
# if the function was not evaluated, undef was returned
|
||||
if(!$nfound) {
|
||||
Log 1, "Unknown message $dmsg, help me!";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach my $found (@found) {
|
||||
if($found =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
|
||||
# The trigger needs a device: we create a minimal temporary one
|
||||
my $d = $1;
|
||||
$defs{$d}{NAME} = $1;
|
||||
$defs{$d}{TYPE} = $last_module;
|
||||
DoTrigger($d, "$2 $3");
|
||||
CommandDelete(undef, $d); # Remove the device
|
||||
$nfound--;
|
||||
} else {
|
||||
DoTrigger($found, undef);
|
||||
}
|
||||
}
|
||||
|
||||
Log 5, "$prefix $nfound devices addressed";
|
||||
return @found;
|
||||
|
||||
}
|
||||
|
||||
#####################################
|
||||
sub
|
||||
CM11_Read($)
|
||||
@ -622,9 +563,12 @@ CM11_Read($)
|
||||
Log 5, "$prefix $housecode_func: " .
|
||||
$hash->{$housecode_func};
|
||||
# dispatch message to clients
|
||||
CM11_Dispatch($hash, $housecode,
|
||||
$hash->{$housecode_unit},
|
||||
$hash->{$housecode_func});
|
||||
|
||||
my $hu = $hash->{$housecode_unit};
|
||||
$hu= "" unless(defined($hu));
|
||||
my $hf = $hash->{$housecode_func};
|
||||
my $dmsg= "X10:$housecode;$hu;$hf";
|
||||
Dispatch($hash, $dmsg);
|
||||
} else {
|
||||
# data byte is unitcode
|
||||
# if a command was executed before, clear unitcode list
|
||||
|
@ -14,8 +14,6 @@ sub CUL_Ready($);
|
||||
sub CUL_HandleCurRequest($$);
|
||||
|
||||
my $initstr = "X21"; # Only translated messages + RSSI
|
||||
my %msghist; # Used when more than one CUL is attached
|
||||
my $msgcount = 0;
|
||||
my %gets = (
|
||||
"version" => "V",
|
||||
"raw" => "",
|
||||
@ -424,17 +422,6 @@ CUL_Write($$$)
|
||||
return;
|
||||
}
|
||||
|
||||
###############
|
||||
# insert value into the msghist. At the moment this only makes sense for FS20
|
||||
# devices. As the transmitted value differs from the received one, we have to
|
||||
# recompute.
|
||||
if($fn eq "F" || $fn eq "T") {
|
||||
$msghist{$msgcount}{TIME} = gettimeofday();
|
||||
$msghist{$msgcount}{NAME} = $hash->{NAME};
|
||||
$msghist{$msgcount}{MSG} = "$fn$msg";
|
||||
$msgcount++;
|
||||
}
|
||||
|
||||
Log 5, "CUL sending $fn$msg";
|
||||
my $bstring = "$fn$msg\n";
|
||||
|
||||
@ -490,7 +477,6 @@ CUL_Read($)
|
||||
my ($hash) = @_;
|
||||
|
||||
my $buf = $hash->{PortObj}->input();
|
||||
my $iohash = $modules{$hash->{TYPE}}; # Our (CUL) module pointer
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
###########
|
||||
@ -558,41 +544,15 @@ CUL_Read($)
|
||||
goto NEXTMSG;
|
||||
}
|
||||
|
||||
###############
|
||||
# check for duplicate msg from different CUL's
|
||||
my $now = gettimeofday();
|
||||
my $skip;
|
||||
my $meetoo = ($attr{$name}{repeater} ? 1 : 0);
|
||||
|
||||
my $to = 0.3;
|
||||
if(defined($attr{$name}) && defined($attr{$name}{filtertimeout})) {
|
||||
$to = $attr{$name}{filtertimeout};
|
||||
}
|
||||
foreach my $oidx (keys %msghist) {
|
||||
if($now-$msghist{$oidx}{TIME} > $to) {
|
||||
delete($msghist{$oidx});
|
||||
next;
|
||||
}
|
||||
if($msghist{$oidx}{MSG} eq $dmsg &&
|
||||
($meetoo || $msghist{$oidx}{NAME} ne $name)) {
|
||||
Log 5, "Skipping $msghist{$oidx}{MSG}";
|
||||
$skip = 1;
|
||||
}
|
||||
}
|
||||
goto NEXTMSG if($skip);
|
||||
$msghist{$msgcount}{TIME} = $now;
|
||||
$msghist{$msgcount}{NAME} = $name;
|
||||
$msghist{$msgcount}{MSG} = $dmsg;
|
||||
$msgcount++;
|
||||
|
||||
if($initstr =~ m/X2/ && $dmsg =~ m/[FEHT]([A-F0-9][A-F0-9])+$/) { # RSSI
|
||||
my $rssi;
|
||||
if($initstr =~ m/X2/ && $dmsg =~ m/[FEHTK]([A-F0-9][A-F0-9])+$/) { # RSSI
|
||||
my $l = length($dmsg);
|
||||
my $rssi = hex(substr($dmsg, $l-2, 2));
|
||||
$rssi = hex(substr($dmsg, $l-2, 2));
|
||||
$dmsg = substr($dmsg, 0, $l-2);
|
||||
$rssi = ($rssi>=128 ? (($rssi-256)/2-74) : ($rssi/2-74));
|
||||
Log GetLogLevel($name,4), "CUL: $dmsg $rssi";
|
||||
Log GetLogLevel($name,4), "$name: $dmsg $rssi";
|
||||
} else {
|
||||
Log GetLogLevel($name,4), "CUL: $dmsg";
|
||||
Log GetLogLevel($name,4), "$name: $dmsg";
|
||||
}
|
||||
|
||||
###########################################
|
||||
@ -639,42 +599,14 @@ CUL_Read($)
|
||||
goto NEXTMSG;
|
||||
}
|
||||
|
||||
|
||||
my @found;
|
||||
my $last_module;
|
||||
foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} }
|
||||
grep {defined($modules{$_}{ORDER});}keys %modules) {
|
||||
next if($iohash->{Clients} !~ m/:$m:/);
|
||||
|
||||
# Module is not loaded or the message is not for this module
|
||||
next if(!$modules{$m}{Match} || $dmsg !~ m/$modules{$m}{Match}/i);
|
||||
|
||||
no strict "refs";
|
||||
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
|
||||
use strict "refs";
|
||||
$last_module = $m;
|
||||
last if(int(@found));
|
||||
my @found = Dispatch($hash, $dmsg);
|
||||
if($rssi) {
|
||||
foreach my $d (@found) {
|
||||
next if(!$defs{$d});
|
||||
$defs{$d}{RSSI} = $rssi;
|
||||
}
|
||||
if(!int(@found)) {
|
||||
Log GetLogLevel($name,3), "Unknown code $dmsg, help me!";
|
||||
goto NEXTMSG;
|
||||
}
|
||||
|
||||
goto NEXTMSG if($found[0] eq ""); # Special return: Do not notify
|
||||
|
||||
# The trigger needs a device: we create a minimal temporary one
|
||||
if($found[0] =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
|
||||
my $d = $1;
|
||||
$defs{$d}{NAME} = $1;
|
||||
$defs{$d}{TYPE} = $last_module;
|
||||
DoTrigger($d, "$2 $3");
|
||||
CommandDelete(undef, $d); # Remove the device
|
||||
goto NEXTMSG;
|
||||
}
|
||||
|
||||
foreach my $found (@found) {
|
||||
DoTrigger($found, undef);
|
||||
}
|
||||
NEXTMSG:
|
||||
}
|
||||
$hash->{PARTIAL} = $culdata;
|
||||
|
@ -48,10 +48,6 @@ my %codes = (
|
||||
"^8501..\$" => "fhtbuf",
|
||||
);
|
||||
|
||||
my $def;
|
||||
my %msghist; # Used when more than one FHZ is attached
|
||||
my $msgcount = 0;
|
||||
|
||||
#####################################
|
||||
# Note: we are a data provider _and_ a consumer at the same time
|
||||
sub
|
||||
@ -355,7 +351,7 @@ FHZ_Parse($$)
|
||||
|
||||
if(!$type) {
|
||||
Log 4, "FHZ $name unknown: $omsg";
|
||||
$def->{CHANGED}[0] = "$msg";
|
||||
$hash->{CHANGED}[0] = "$msg";
|
||||
return $hash->{NAME};
|
||||
}
|
||||
|
||||
@ -365,7 +361,7 @@ FHZ_Parse($$)
|
||||
}
|
||||
|
||||
Log 4, "FHZ $name $type: $msg";
|
||||
$def->{CHANGED}[0] = "$type: $msg";
|
||||
$hash->{CHANGED}[0] = "$type: $msg";
|
||||
return $hash->{NAME};
|
||||
}
|
||||
|
||||
@ -498,18 +494,6 @@ FHZ_Write($$$)
|
||||
return;
|
||||
}
|
||||
|
||||
###############
|
||||
# insert value into the msghist. At the moment this only makes sense for FS20
|
||||
# devices. As the transmitted value differs from the received one, we have to
|
||||
# recompute.
|
||||
if($fn eq "04" && substr($msg,0,6) eq "010101") {
|
||||
my $nmsg = "0101a001" . substr($msg, 6, 6) . "00" . substr($msg, 12);
|
||||
$msghist{$msgcount}{TIME} = gettimeofday();
|
||||
$msghist{$msgcount}{NAME} = $hash->{NAME};
|
||||
$msghist{$msgcount}{MSG} = unpack('H*', FHZ_CompleteMsg($fn, $nmsg));
|
||||
$msgcount++;
|
||||
}
|
||||
|
||||
my $bstring = FHZ_CompleteMsg($fn, $msg);
|
||||
Log 5, "Sending " . unpack('H*', $bstring);
|
||||
|
||||
@ -652,70 +636,8 @@ FHZ_Read($)
|
||||
$fhzdata = substr($fhzdata, 2);
|
||||
next;
|
||||
}
|
||||
my @found = Dispatch($hash, $dmsg);
|
||||
|
||||
###############
|
||||
# check for duplicate msg from different FHZ's
|
||||
my $now = gettimeofday();
|
||||
my $skip;
|
||||
my $meetoo = ($attr{$name}{repeater} ? 1 : 0);
|
||||
|
||||
my $to = 3;
|
||||
if(defined($attr{$name}) && defined($attr{$name}{filtertimeout})) {
|
||||
$to = $attr{$name}{filtertimeout};
|
||||
}
|
||||
foreach my $oidx (keys %msghist) {
|
||||
if($now-$msghist{$oidx}{TIME} > $to) {
|
||||
delete($msghist{$oidx});
|
||||
next;
|
||||
}
|
||||
if($msghist{$oidx}{MSG} eq $dmsg &&
|
||||
($meetoo || $msghist{$oidx}{NAME} ne $name)) {
|
||||
Log 5, "Skipping $msghist{$oidx}{MSG}";
|
||||
$skip = 1;
|
||||
}
|
||||
}
|
||||
goto NEXTMSG if($skip);
|
||||
$msghist{$msgcount}{TIME} = $now;
|
||||
$msghist{$msgcount}{NAME} = $name;
|
||||
$msghist{$msgcount}{MSG} = $dmsg;
|
||||
$msgcount++;
|
||||
|
||||
|
||||
my @found;
|
||||
my $last_module;
|
||||
foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} }
|
||||
grep {defined($modules{$_}{ORDER});}keys %modules) {
|
||||
next if($iohash->{Clients} !~ m/:$m:/);
|
||||
|
||||
# Module is not loaded or the message is not for this module
|
||||
next if(!$modules{$m}{Match} || $dmsg !~ m/$modules{$m}{Match}/i);
|
||||
|
||||
no strict "refs";
|
||||
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
|
||||
use strict "refs";
|
||||
$last_module = $m;
|
||||
last if(int(@found));
|
||||
}
|
||||
if(!int(@found)) {
|
||||
Log 1, "Unknown code $dmsg, help me!";
|
||||
goto NEXTMSG;
|
||||
}
|
||||
|
||||
goto NEXTMSG if($found[0] eq ""); # Special return: Do not notify
|
||||
|
||||
# The trigger needs a device: we create a minimal temporary one
|
||||
if($found[0] =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
|
||||
my $d = $1;
|
||||
$defs{$d}{NAME} = $1;
|
||||
$defs{$d}{TYPE} = $last_module;
|
||||
DoTrigger($d, "$2 $3");
|
||||
CommandDelete(undef, $d); # Remove the device
|
||||
goto NEXTMSG;
|
||||
}
|
||||
|
||||
foreach my $found (@found) {
|
||||
DoTrigger($found, undef);
|
||||
}
|
||||
NEXTMSG:
|
||||
$fhzdata = substr($fhzdata, $len);
|
||||
|
||||
|
@ -101,7 +101,7 @@ FS20_Initialize($)
|
||||
$hash->{DefFn} = "FS20_Define";
|
||||
$hash->{UndefFn} = "FS20_Undef";
|
||||
$hash->{ParseFn} = "FS20_Parse";
|
||||
$hash->{AttrList} = "follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6";
|
||||
|
||||
}
|
||||
|
||||
@ -345,6 +345,7 @@ FS20_Parse($$)
|
||||
my @list;
|
||||
foreach my $n (keys %{ $def }) {
|
||||
my $lh = $def->{$n};
|
||||
return "" if($lh->{IODev} && $lh->{IODev}{NAME} ne $hash->{NAME});
|
||||
$lh->{CHANGED}[0] = $v;
|
||||
$lh->{STATE} = $v;
|
||||
$lh->{READINGS}{state}{TIME} = TimeNow();
|
||||
|
@ -143,7 +143,7 @@ FHT_Initialize($)
|
||||
$hash->{DefFn} = "FHT_Define";
|
||||
$hash->{UndefFn} = "FHT_Undef";
|
||||
$hash->{ParseFn} = "FHT_Parse";
|
||||
$hash->{AttrList} = "do_not_notify:0,1 model;fht80b dummy:0,1 " .
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 model;fht80b dummy:0,1 " .
|
||||
"showtime:0,1 loglevel:0,1,2,3,4,5,6 retrycount minfhtbuffer";
|
||||
}
|
||||
|
||||
@ -320,6 +320,8 @@ FHT_Parse($$)
|
||||
my $def = $defptr{$dev};
|
||||
my $name = $def->{NAME};
|
||||
|
||||
return "" if($def->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
|
||||
|
||||
# Short message
|
||||
if(length($msg) < 26) {
|
||||
Log 4,"FHT Short message. Device $name, Message: $msg";
|
||||
|
@ -39,7 +39,7 @@ HMS_Initialize($)
|
||||
$hash->{DefFn} = "HMS_Define";
|
||||
$hash->{UndefFn} = "HMS_Undef";
|
||||
$hash->{ParseFn} = "HMS_Parse";
|
||||
$hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model;hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model;hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit loglevel:0,1,2,3,4,5,6";
|
||||
}
|
||||
|
||||
#####################################
|
||||
@ -78,6 +78,8 @@ HMS_Parse($$)
|
||||
|
||||
my $dev = substr($msg, 16, 4);
|
||||
my $cde = substr($msg, 11, 1);
|
||||
012345678901234567890123456789
|
||||
# 810e047f0214a001a81f000001000000 HMS100TFK
|
||||
my $val = substr($msg, 24, 8) if(length($msg) == 32);
|
||||
|
||||
my $type = "";
|
||||
@ -103,6 +105,7 @@ HMS_Parse($$)
|
||||
}
|
||||
|
||||
my $def = $defptr{$dev};
|
||||
return "" if($def->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
|
||||
|
||||
my (@v, @txt, @sfx);
|
||||
|
||||
|
@ -20,7 +20,7 @@ KS300_Initialize($)
|
||||
$hash->{DefFn} = "KS300_Define";
|
||||
$hash->{UndefFn} = "KS300_Undef";
|
||||
$hash->{ParseFn} = "KS300_Parse";
|
||||
$hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model:ks300 loglevel:0,1 rainadjustment:0,1";
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:ks300 loglevel:0,1 rainadjustment:0,1";
|
||||
}
|
||||
|
||||
#####################################
|
||||
@ -89,6 +89,8 @@ KS300_Parse($$)
|
||||
my $haverain = 0;
|
||||
my $name= $def->{NAME};
|
||||
|
||||
return "" if($def->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
|
||||
|
||||
my @v;
|
||||
my @txt = ( "rain_raw", "rain", "wind", "humidity", "temperature",
|
||||
"israining", "unknown1", "unknown2", "unknown3");
|
||||
|
@ -27,7 +27,7 @@ CUL_WS_Initialize($)
|
||||
$hash->{DefFn} = "CUL_WS_Define";
|
||||
$hash->{UndefFn} = "CUL_WS_Undef";
|
||||
$hash->{ParseFn} = "CUL_WS_Parse";
|
||||
$hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model:S300TH,KS300 loglevel";
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:S300TH,KS300 loglevel";
|
||||
}
|
||||
|
||||
|
||||
@ -85,6 +85,8 @@ CUL_WS_Parse($$)
|
||||
Log 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
|
||||
return "UNDEFINED CUL_WS: $cde";
|
||||
}
|
||||
my $def = $defptr{$cde};
|
||||
return "" if($def->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
|
||||
|
||||
$hash = $defptr{$cde};
|
||||
my $name = $hash->{NAME};
|
||||
|
@ -19,7 +19,7 @@ CUL_EM_Initialize($)
|
||||
$hash->{DefFn} = "CUL_EM_Define";
|
||||
$hash->{UndefFn} = "CUL_EM_Undef";
|
||||
$hash->{ParseFn} = "CUL_EM_Parse";
|
||||
$hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model:EMEM,EMWZ,EMGZ loglevel";
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:EMEM,EMWZ,EMGZ loglevel";
|
||||
}
|
||||
|
||||
#####################################
|
||||
@ -101,6 +101,9 @@ CUL_EM_Parse($$)
|
||||
$seqno, $total_cnt, $current_cnt, $peak_cnt);
|
||||
|
||||
if($defptr{$cde}) {
|
||||
my $def = $defptr{$cde};
|
||||
return "" if($def->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
|
||||
|
||||
$hash = $defptr{$cde};
|
||||
|
||||
my $tn = TimeNow(); # current time
|
||||
|
@ -104,8 +104,7 @@ X10_Initialize($)
|
||||
$hash->{DefFn} = "X10_Define";
|
||||
$hash->{UndefFn} = "X10_Undef";
|
||||
$hash->{ParseFn} = "X10_Parse";
|
||||
$hash->{AttrList} = "follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0
|
||||
showtime:1,0 model:lm12,lm15,am12,tm13 loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 dummy:1,0 showtime:1,0 model:lm12,lm15,am12,tm13 loglevel:0,1,2,3,4,5,6";
|
||||
|
||||
}
|
||||
|
||||
@ -349,6 +348,7 @@ X10_Parse($$)
|
||||
foreach my $unitcode (@unitcodes) {
|
||||
my $h= $devices{$housecode}{$unitcode};
|
||||
if($h) {
|
||||
return "" if($h->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
|
||||
my $name= $h->{NAME};
|
||||
$h->{CHANGED}[0] = $value;
|
||||
$h->{STATE} = $value;
|
||||
|
@ -20,7 +20,7 @@ EMWZ_Initialize($)
|
||||
$hash->{SetFn} = "EMWZ_Set";
|
||||
$hash->{DefFn} = "EMWZ_Define";
|
||||
|
||||
$hash->{AttrList} = "dummy:1,0 model;EM1000WZ loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "IODev dummy:1,0 model;EM1000WZ loglevel:0,1,2,3,4,5,6";
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ EMEM_Initialize($)
|
||||
$hash->{GetFn} = "EMEM_Get";
|
||||
$hash->{DefFn} = "EMEM_Define";
|
||||
|
||||
$hash->{AttrList} = "dummy:1,0 model;EM1000EM loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "IODev dummy:1,0 model;EM1000EM loglevel:0,1,2,3,4,5,6";
|
||||
}
|
||||
|
||||
###################################
|
||||
|
@ -20,7 +20,7 @@ EMGZ_Initialize($)
|
||||
$hash->{SetFn} = "EMGZ_Set";
|
||||
$hash->{DefFn} = "EMGZ_Define";
|
||||
|
||||
$hash->{AttrList} = "dummy:1,0 model;EM1000GZ loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AttrList} = "IODev dummy:1,0 model;EM1000GZ loglevel:0,1,2,3,4,5,6";
|
||||
}
|
||||
|
||||
|
||||
|
@ -367,3 +367,7 @@
|
||||
is sent back. The CUR must have reception enabled.
|
||||
Right now status/set time/set FHT desired temp are implemented.
|
||||
|
||||
- Fri Jan 9
|
||||
- Added a unified dispatch for CUL/FHZ and CM11, since all of them used the
|
||||
same code.
|
||||
- Addedd IODev attribute to FS20/FHT/HMS/KS300/CUL_WS/CUL/EMWZ/EMGZ/EMEM
|
||||
|
@ -1134,17 +1134,27 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
|
||||
<b>Get</b> <ul>N/A</ul><br>
|
||||
|
||||
<a name="FS20attributes"></a>
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<a name="IODev"></a>
|
||||
<li>IODev<br>
|
||||
Set the IO or physical device which should be used for receiving /
|
||||
sending signals for this "logical" device. An example for the physical
|
||||
device is an FHZ or a CUL. Note: Upon startup fhem assigns each logical
|
||||
device (FS20/HMS/KS300/etc) the last physical device which can receive
|
||||
data for this type of device. The attribute IODev should be used only
|
||||
if you attached more than one physical device capable of receiving
|
||||
signals for this logical device.</li><br>
|
||||
|
||||
<li><a href="#do_not_notify">do_not_notify</a></li><br>
|
||||
<a name="dummy"></a>
|
||||
<li>dummy<br>
|
||||
Can be applied to FS20/FHT devices.<br>
|
||||
Set the device attribute dummy to define devices which should not
|
||||
output any radio signals. Associated notifys will be executed if
|
||||
the signal is received. Used e.g. to react to a code from a sender, but
|
||||
it will not emit radio signal if triggered in the web frontend.
|
||||
Implemented for FS20 and FHT devices.</li><br>
|
||||
</li><br>
|
||||
|
||||
<a name="follow-on-for-timer"></a>
|
||||
<li>follow-on-for-timer<br>
|
||||
@ -1377,6 +1387,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#loglevel">loglevel</a></li><br>
|
||||
<li><a href="#model">model</a> (fht80b)</li><br>
|
||||
<li><a href="#showtime">showtime</a></li><br>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
|
||||
<a name="retrycount"></a>
|
||||
<li>retrycount<br/>
|
||||
@ -1463,6 +1474,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#do_not_notify">do_not_notify</a></li><br>
|
||||
<li><a href="#loglevel">loglevel</a></li><br>
|
||||
<li><a href="#showtime">showtime</a></li><br>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
<li><a href="#model">model</a> (hms100-t hms100-tf hms100-wd hms100-mg
|
||||
hms100-co hms100-tfk hms100-fit rm100-2)</li>
|
||||
</ul>
|
||||
@ -1588,6 +1600,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#showtime">showtime</a></li><br>
|
||||
<li><a href="#loglevel">loglevel</a></li><br>
|
||||
<li><a href="#model">model</a> (S300,KS300,WS7000)</li><br>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@ -1628,6 +1641,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#showtime">showtime</a></li><br>
|
||||
<li><a href="#loglevel">loglevel</a></li><br>
|
||||
<li><a href="#model">model</a> (EMEM,EMWZ,EMGZ)</li><br>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@ -1744,6 +1758,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#model">model</a> (EM1000WZ)</li>
|
||||
<li><a href="#dummy">dummy</a></li>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@ -1797,6 +1812,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#model">model</a> (EM1000GZ)</li>
|
||||
<li><a href="#dummy">dummy</a></li>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@ -1843,6 +1859,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#model">model</a> (EM1000EM)</li>
|
||||
<li><a href="#dummy">dummy</a></li>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@ -2052,6 +2069,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li><a href="#showtime">showtime</a></li><br>
|
||||
<li><a href="#model">model</a> (lm12,lm15,am12,tm13)</li><br>
|
||||
<li><a href="#loglevel">loglevel</a></li>
|
||||
<li><a href="#IODev">IODev</a></li><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
|
59
fhem/fhem.pl
59
fhem/fhem.pl
@ -46,6 +46,7 @@ sub AssignIoPort($);
|
||||
sub CallFn(@);
|
||||
sub CommandChain($$);
|
||||
sub DoClose($);
|
||||
sub Dispatch($$);
|
||||
sub FmtDateTime($);
|
||||
sub FmtTime($);
|
||||
sub GetLogLevel(@);
|
||||
@ -148,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.62 2009-01-03 12:30:29 rudolfkoenig Exp $';
|
||||
my $cvsid = '$Id: fhem.pl,v 1.63 2009-01-09 17:31:43 rudolfkoenig Exp $';
|
||||
my $namedef =
|
||||
"where <name> is either:\n" .
|
||||
"- a single device name\n" .
|
||||
@ -1415,6 +1416,11 @@ CommandAttr($$)
|
||||
next;
|
||||
}
|
||||
|
||||
if($a[1] eq "IODev" && (!$a[2] || !defined($defs{$a[2]}))) {
|
||||
push @rets,"Unknown IODev specified";
|
||||
next;
|
||||
}
|
||||
|
||||
$a[0] = $sdev;
|
||||
$ret = CallFn($sdev, "AttrFn", "set", @a);
|
||||
if($ret) {
|
||||
@ -1427,6 +1433,7 @@ CommandAttr($$)
|
||||
} else {
|
||||
$attr{$sdev}{$a[1]} = "1";
|
||||
}
|
||||
$defs{$sdev}{IODev} = $defs{$a[2]} if($a[1] eq "IODev");
|
||||
|
||||
}
|
||||
return join("\n", @rets);
|
||||
@ -1942,3 +1949,53 @@ HandleArchiving($)
|
||||
}
|
||||
}
|
||||
|
||||
#####################################
|
||||
# Call a logical device (FS20) ParseMessage with data from a physical device
|
||||
# (FHZ)
|
||||
sub
|
||||
Dispatch($$)
|
||||
{
|
||||
my ($hash, $dmsg) = @_;
|
||||
my $iohash = $modules{$hash->{TYPE}}; # The phyiscal device module pointer
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
Log 5, "$name dispatch $dmsg";
|
||||
|
||||
my @found;
|
||||
my $last_module;
|
||||
foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} }
|
||||
grep {defined($modules{$_}{ORDER});}keys %modules) {
|
||||
next if($iohash->{Clients} !~ m/:$m:/);
|
||||
|
||||
# Module is not loaded or the message is not for this module
|
||||
next if(!$modules{$m}{Match} || $dmsg !~ m/$modules{$m}{Match}/i);
|
||||
|
||||
no strict "refs";
|
||||
@found = &{$modules{$m}{ParseFn}}($hash,$dmsg);
|
||||
use strict "refs";
|
||||
$last_module = $m;
|
||||
last if(int(@found));
|
||||
}
|
||||
if(!int(@found)) {
|
||||
Log GetLogLevel($name,3), "$name: Unknown code $dmsg, help me!";
|
||||
return "";
|
||||
}
|
||||
|
||||
return if($found[0] eq ""); # Special return: Do not notify
|
||||
|
||||
foreach my $found (@found) {
|
||||
if($found =~ m/^(UNDEFINED) ([^ ]*) (.*)$/) {
|
||||
# The trigger needs a device: we create a minimal temporary one
|
||||
my $d = $1;
|
||||
$defs{$d}{NAME} = $1;
|
||||
$defs{$d}{TYPE} = $last_module;
|
||||
DoTrigger($d, "$2 $3");
|
||||
CommandDelete(undef, $d); # Remove the device
|
||||
goto NEXTMSG;
|
||||
} else {
|
||||
DoTrigger($found, undef);
|
||||
}
|
||||
}
|
||||
|
||||
return @found;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user