diff --git a/CHANGED b/CHANGED
index bc9f0839c..14adf67e8 100644
--- a/CHANGED
+++ b/CHANGED
@@ -505,4 +505,6 @@
- feature: Google Weather API support for FHEM (Boris 2009-06-01)
- feature: lazy attribute for FHT devices (Boris 2009-06-09)
- feature: tmpcorr attribute for FHT devices
+ - feature: CUL_EM generates an event for each of the READINGS
- feature: USF1000S support for FHEM added (Boris 2009-06-20)
+ - feature: CUL supports HMS (culfw >= 1.22 needed)
diff --git a/FHEM/00_CUL.pm b/FHEM/00_CUL.pm
index 62bd83416..f586e26d3 100755
--- a/FHEM/00_CUL.pm
+++ b/FHEM/00_CUL.pm
@@ -48,14 +48,15 @@ CUL_Initialize($)
# Provider
$hash->{ReadFn} = "CUL_Read";
$hash->{WriteFn} = "CUL_Write";
- $hash->{Clients} = ":FS20:FHT:KS300:CUL_EM:CUL_WS:USF1000:";
+ $hash->{Clients} = ":FS20:FHT:KS300:CUL_EM:CUL_WS:USF1000:HMS:";
my %mc = (
"1:USF1000" => "^81..(04|0c)..0101a001a5ceaa00....",
"2:FS20" => "^81..(04|0c)..0101a001",
"3:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
"4:KS300" => "^810d04..4027a001",
"5:CUL_WS" => "^K.....",
- "6:CUL_EM" => "^E0.................\$"
+ "6:CUL_EM" => "^E0.................\$",
+ "7:HMS" => "^810e04....(1|5|9).a001",
);
$hash->{MatchList} = \%mc;
$hash->{ReadyFn} = "CUL_Ready";
@@ -696,7 +697,8 @@ CUL_Read($)
}
my $rssi;
- if($initstr =~ m/X2/ && $dmsg =~ m/[FEHTK]([A-F0-9][A-F0-9])+$/) { # RSSI
+ my $rmsg = $dmsg;
+ if($initstr =~ m/X2/ && $dmsg =~ m/[FTKEHR]([A-F0-9][A-F0-9])+$/) { # RSSI
my $l = length($dmsg);
$rssi = hex(substr($dmsg, $l-2, 2));
$dmsg = substr($dmsg, 0, $l-2);
@@ -723,13 +725,19 @@ CUL_Read($)
}
$dmsg = sprintf("81%02x04xx0101a001%s00%s",
- $len/2+5, substr($dmsg,1,6), substr($dmsg,7));
+ $len/2+7, substr($dmsg,1,6), substr($dmsg,7));
$dmsg = lc($dmsg);
} elsif($fn eq "T" && $len >= 11) { # Reformat for 11_FHT.pm
$dmsg = sprintf("81%02x04xx0909a001%s00%s",
- $len/2+5, substr($dmsg,1,6), substr($dmsg,7));
+ $len/2+7, substr($dmsg,1,6), substr($dmsg,7));
+ $dmsg = lc($dmsg);
+
+ } elsif($fn eq "H" && $len >= 13) { # Reformat for 12_HMS.pm
+
+ $dmsg = sprintf("81%02x04xxxx5%sa001%s0000%s",
+ $len/2+8, substr($dmsg,6,1), substr($dmsg,1,4), substr($dmsg,5));
$dmsg = lc($dmsg);
} elsif($fn eq "K" && $len >= 5) {
@@ -749,12 +757,15 @@ CUL_Read($)
Log GetLogLevel($name,2), "CUL: unknown message $dmsg";
goto NEXTMSG;
}
+
$hash->{RSSI} = $rssi;
+ $hash->{RAWMSG} = $rmsg;
my $foundp = Dispatch($hash, $dmsg);
- if($foundp && $rssi) {
+ if($foundp) {
foreach my $d (@{$foundp}) {
next if(!$defs{$d});
- $defs{$d}{RSSI} = $rssi;
+ $defs{$d}{RSSI} = $rssi if($rssi);
+ $defs{$d}{RAWMSG} = $rmsg;
}
}
diff --git a/FHEM/00_FHZ.pm b/FHEM/00_FHZ.pm
index 7e7bc696e..223d797b2 100755
--- a/FHEM/00_FHZ.pm
+++ b/FHEM/00_FHZ.pm
@@ -59,11 +59,11 @@ FHZ_Initialize($)
$hash->{WriteFn} = "FHZ_Write";
$hash->{Clients} = ":FHZ:FS20:FHT:HMS:KS300:USF1000:";
my %mc = (
- "0:USF1000" => "^810c04..0101a001a5ceaa00...."
- "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",
+ "1:USF1000" => "^810c04..0101a001a5ceaa00....",
+ "2:FS20" => "^81..(04|0c)..0101a001",
+ "3:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
+ "4:HMS" => "^810e04....(1|5|9).a001",
+ "5:KS300" => "^810d04..4027a001",
);
$hash->{MatchList} = \%mc;
$hash->{ReadyFn} = "FHZ_Ready";
@@ -673,7 +673,16 @@ FHZ_Read($)
$fhzdata = substr($fhzdata, 2);
next;
}
- Dispatch($hash, $dmsg);
+
+ $hash->{RAWMSG} = $dmsg;
+ my $foundp = Dispatch($hash, $dmsg);
+ if($foundp) {
+ foreach my $d (@{$foundp}) {
+ next if(!$defs{$d});
+ $defs{$d}{RAWMSG} = $dmsg;
+ }
+ }
+
$fhzdata = substr($fhzdata, $len);
} else {
diff --git a/FHEM/12_HMS.pm b/FHEM/12_HMS.pm
index 87d83dfa7..cf10f5967 100755
--- a/FHEM/12_HMS.pm
+++ b/FHEM/12_HMS.pm
@@ -66,7 +66,8 @@ sub
HMS_Undef($$)
{
my ($hash, $name) = @_;
- delete($defptr{$hash->{CODE}});
+ delete($defptr{$hash->{CODE}})
+ if(defined($hash->{CODE}) && defined($defptr{$hash->{CODE}}));
return undef;
}
@@ -216,7 +217,7 @@ HMS_Parse($$)
} else {
- Log 4, "HMS Device $dev (Unknown type: $type)";
+ Log 3, "HMS Device $dev (Unknown type: $type)";
return "";
}
diff --git a/docs/commandref.html b/docs/commandref.html
index 5658d7aec..78f409b4d 100644
--- a/docs/commandref.html
+++ b/docs/commandref.html
@@ -1540,7 +1540,8 @@ A line ending with \ will be concatenated with the next one, so long lines
The CUL is an USB device sold by busware.de
. With the opensource firmware (see this google discussion) it is
- capable to receive/send different 868MHz protocols, e.g. FS20/FHT/S300/EM.
+ capable to receive and send different 868MHz protocols
+ (FS20/FHT/S300/EM/HMS).
Some protocols (FS20/FHT) are converted by this module so that the same
logical device can be used, irrespective if the radio telegram is received by
diff --git a/docs/fhem.html b/docs/fhem.html
index e3894cf4c..e261fb3f3 100644
--- a/docs/fhem.html
+++ b/docs/fhem.html
@@ -56,7 +56,7 @@ Currently implemented features: