From 4fd5d7becbb239a5f8fb69aae1f35657e26b67ce Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Mon, 16 May 2016 18:33:20 +0000 Subject: [PATCH] CUL_HM:bright sensor git-svn-id: https://svn.fhem.de/fhem/trunk@11471 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_CUL_HM.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index 5c8166266..58f7058fc 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -2133,19 +2133,19 @@ sub CUL_HM_Parse($$) {######################################################### elsif($mh{st} eq "senBright") { ############################################# if ($mh{mTp} =~ m/5[34]/){ - #Channel ist fixed 1 - my ($chn,undef,$dat) = unpack 'A2A2A8',$mh{p}; + #Channel is fixed 1 + my ($chn,$unkn,$dat) = unpack 'A2A2A8',$mh{p};# chn = 01 push @evtEt,[$mh{devH},1,"battery:".(hex($chn)&0x80?"low":"ok")]; - $dat = sprintf("%0.1f",hex($dat)*100); + + $dat = sprintf("%0.2f",hex($dat))/100; #down to 0.01lux per docu - my $chnHash = $modules{CUL_HM}{defptr}{$mh{src}."01"};#fixed channel - if ($chnHash){ - push @evtEt,[$chnHash,1,"state:bright: $dat"]; - push @evtEt,[$chnHash,1,"bright:$dat"]; - } - else{ - push @evtEt,[$mh{devH},1,"Chan_01:brigth: $dat"]; - } + # verify whether we have a channel or will use the Device instead + my $cHash = ($modules{CUL_HM}{defptr}{$mh{src}."01"}) + ?$modules{CUL_HM}{defptr}{$mh{src}."01"} + :$mh{devH}; + push @evtEt,[$cHash,1,"state:B: $dat"]; + push @evtEt,[$cHash,1,"brightness:$dat"]; + push @evtEt,[$cHash,1,"unknown: 0x".$unkn]; # read 0xC1, but what is it? } } elsif($mh{st} eq "powerSensor") {############################################