From fe03d3626c9728656dcc38662d34230934e38206 Mon Sep 17 00:00:00 2001 From: klaus-schauer Date: Mon, 24 Jun 2013 13:46:21 +0000 Subject: [PATCH] # TCM120: eliminates errors when receiving ORG 05/06 telegrams # sub TCM_Parse310: incorrect output fixed git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@3323 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/00_TCM.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/fhem/FHEM/00_TCM.pm b/fhem/FHEM/00_TCM.pm index 14814b6af..fa7680db5 100755 --- a/fhem/FHEM/00_TCM.pm +++ b/fhem/FHEM/00_TCM.pm @@ -115,17 +115,17 @@ TCM_Write($$$) $bstring = $msg; } else { # command with ESP3 format - my $packetType = hex (substr ($fn, 6, 2)); + my $packetType = hex(substr($fn, 6, 2)); if ($packetType != 1) { Log $ll2, "TCM120 $name: Packet Type not supported."; return; } - my $odataLen = hex (substr ($fn, 4, 2)); + my $odataLen = hex(substr($fn, 4, 2)); if ($odataLen != 0) { Log $ll2, "TCM120 $name: Radio Telegram with optional Data not supported."; return; } - #my $mdataLen = hex (substr ($fn, 0, 4)); + #my $mdataLen = hex(substr($fn, 0, 4)); my $rorg = substr ($msg, 0, 2); # translate the RORG to ORG my %rorgmap = ("F6"=>"05", @@ -253,7 +253,10 @@ TCM_Read($) } else { Log 1, "TCM120: unknown ORG mapping for $org"; } - + if ($org ne "A5") { + # extract db_0 + $d1 = substr($d1, 0, 2); + } if ($blockSenderID eq "own" && (hex $id) >= $baseID && (hex $id) <= $lastID) { Log $ll5, "TCM: $name Telegram from $id blocked."; } else { @@ -446,16 +449,13 @@ TCM_Parse310($$$) my $name = $hash->{NAME}; my $ll5 = GetLogLevel($name,5); my $ll2 = GetLogLevel($name,2); - Log $ll5, "TCM: Parse $rawmsg"; - my $rc = substr($rawmsg, 0, 2); - my $msg; + my $msg = ""; if($rc ne "00") { - my $msg = $rc310{$rc}; + $msg = $rc310{$rc}; $msg = "Unknown return code $rc" if(!$msg); - } else { my @ans; foreach my $k (sort keys %{$ptr}) { @@ -565,6 +565,7 @@ TCM_RemovePair($) { my $hash = shift; delete($hash->{pair}); + CommandDeleteReading(undef, "$hash->{NAME} pair"); } my %sets120 = ( # Name, Data to send to the CUL, Regexp for the answer @@ -616,6 +617,7 @@ TCM_Set($@) if($cmd eq "pairForSec") { $hash->{pair} = 1; + readingsSingleUpdate($hash, "pair", 1, 1); InternalTimer(gettimeofday()+$arg, "TCM_RemovePair", $hash, 1); return; }