From 3b2e61cb15eac3752cb44ef20fb143660f807e92 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Sun, 26 Jul 2009 09:17:05 +0000 Subject: [PATCH] HMS parsing from Peter git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@417 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/00_CUL.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/FHEM/00_CUL.pm b/FHEM/00_CUL.pm index bbc418b7a..6e30ab06c 100755 --- a/FHEM/00_CUL.pm +++ b/FHEM/00_CUL.pm @@ -747,13 +747,17 @@ CUL_Read($) } elsif($fn eq "H" && $len >= 13) { # Reformat for 12_HMS.pm my $type = hex(substr($dmsg,6,1)); + my $stat = $type > 1 ? hex(substr($dmsg,7,2)) : hex(substr($dmsg,5,2)); my $prf = $type > 1 ? "02" : "05"; my $bat = $type > 1 ? hex(substr($dmsg,5,1))+1 : 1; - $dmsg = sprintf("81%02x04xx%s%x%xa001%s0000%s", - $len/2+8, # Packet-Length + my $HA = substr($dmsg,1,4); + my $values = $type > 1 ? "000000" : substr($dmsg,7); + $dmsg = sprintf("81%02x04xx%s%x%xa001%s0000%02x%s", + $len/2+8, # Packet-Length $prf, $bat, $type, - substr($dmsg,1,4), # House-Code - substr($dmsg,5)); # Values + $HA, # House-Code + $stat, + $values); # Values $dmsg = lc($dmsg); } elsif($fn eq "K" && $len >= 5) {